构建linux下的web服务器

1、从源码安装 apache
=================================================================
apache
-----------------------------------------------------------------
./configure --prefix=/usr/local/httpd --enable-mods-shared=all --enable-so --enable-deflate --enable-rewrite --enable-info

make && make install

# 查看配置参数
httpd -V

 

2、源码安装 php
=================================================================
php
-----------------------------------------------------------------
dependences:
libxml2.x86_64
libxml2-devel.x86_64
./configure --prefix=/usr/local/php-5.2.17 --with-apxs2=/usr/local/httpd-2.2.22/bin/apxs --with-mysql=shared,/usr --with-zlib-dir --with-mysqli=/usr/lib64/mysql/mysql_config --libdir=/usr/lib64 --with-libdir=lib64 --with-pdo-mysql --with-curl --with-gd --with-config-file-path=conf/php.ini

make && make install

编译php生成扩展

     进入php源程序目录中的ext目录中,这里存放着各个扩展模块的源代码,选择你需要的模块,比如curl模块:
     cd curl
     执行phpize生成编译文件,phpize在PHP安装目录的bin目录下
     /usr/local/php5/bin/phpize
     运行时,可能会报错:Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF
                                 environment variable is set correctly and then rerun this script.“,需要安装autoconf:
     yum install autoconf(RedHat或者CentOS)、apt-get install autoconf(Ubuntu Linux)

生成配置文件,并编译生成模块:

     /usr/local/php-5.2.17/bin/phpize
     ./configure --enable-shared --with-eaccelerator-info --with-php-config=/usr/local/php-5.2.17/bin/php-config  
     make && make install  

这样,curl.so就被复制到PHP对应目录(如:/usr/local/php5/lib/php/extensions/no-debug-non-zts-20090626/)

 

3、源码编译 nginx

=================================================================
configure with nginx:
-----------------------------------------------------------------
./configure configure arguments: --prefix=/usr/local/nginx-1.2.6 --with-pcre=/app/temp/pcre-8.32 --with-debug --with-http_realip_module --with-poll_module --with-ipv6 --with-http_ssl_module --with-http_geoip_module --with-http_gzip_static_module --with-mail --with-mail_ssl_module --with-http_stub_status_module --add-module=/NGX_CONCAT_SOURCE_FILE_PATH

make && make install

# 查看配置参数
/usr/local/nginx-1.2.8/sbin/nginx -V

 

4、安装 apache rpaf 模块

=================================================================
安装 mod_rpaf 模块
-----------------------------------------------------------------
安装
tar zxvf mod_rpaf-0.6.tar.gz
cd mod_rpaf-0.6
/usr/local/www/apache/bin/apxs -i -c -n mod_rpaf-2.0.so mod_rpaf-2.0.c
接着在 httpd.conf 中添加
LoadModule rpaf_module modules/mod_rpaf-2.0.so
RPAFenable On
RPAFsethostname On
RPAFproxy_ips 127.0.0.1 # 填写Nginx的的ip 
RPAFheader X-Forwarded-For 
这样就可以获取客户端访问的真实IP了

你可能感兴趣的:(linux,Web,server,configure)