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了