linux 安装 nginx

—- install nginx

# yum install -y httpd-devel pcre perl pcre-devel zlib zlib-devel GeoIP GeoIP-devel
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.36.tar.gz
wget http://zlib.net/zlib-1.2.8.tar.gz
wget http://www.openssl.org/source/openssl-1.0.1m.tar.gz

./configure –prefix=/data/lib/zlib-1.2.8
make & make install

安装pcre报错You need a C++ compiler for C++ support
解决办法 sudo apt-get install build-essential

./configure –prefix=/data/lib/pcre-8.36
make & make install

apt-get install libxml2 libxslt1-dev libxml2-dev
apt-get install libgd2-xpm-dev
apt-get install geoip-database libgeoip-dev
##apt-get install libpcre3 libpcre3-dev

yum list | grep geo
yum install gcc-c++

# error: C compiler cc is not found
yum install gcc
# the HTTP XSLT module requires the libxml2/libxslt
yum install libxml2-devel libxslt-devel
# the HTTP image filter module requires the GD library.
yum install gd-devel
# the GeoIP module requires the GeoIP library.
# –with-http_geoip_module
yum install GeoIP GeoIP-data GeoIP-devel

#首先定义新的Nginx名称:
NGINX_BANNER=”superServer”
#执行更名操作

sed -i “s#\”NGINX\”#\”$NGINX_BANNER\”#” src/core/nginx.h
sed -i “s#\”nginx/\”#\”$NGINX_BANNER/\”#” src/core/nginx.h
sed -i “s#Server: nginx#Server: $NGINX_BANNER#” src/http/ngx_http_header_filter_module.c
sed -i “s#\”<hr><center>nginx<\/center>\”#\”<hr><center>$NGINX_BANNER<\/center>\”#” src/http/ngx_http_special_response.c

 

export DATA=/data/download
export NG_HOME=/data/server/nginx
./configure –prefix=$NG_HOME –user=nobody –group=nobody –sbin-path=$NG_HOME/sbin/nginx –conf-path=$NG_HOME/conf/nginx.conf –error-log-path=$NG_HOME/logs/error.log –pid-path=$NG_HOME/var/nginx.pid –lock-path=$NG_HOME/var/nginx.lock –http-log-path=$NG_HOME/logs/access.log –http-client-body-temp-path=$NG_HOME/temp/client_body_temp –http-proxy-temp-path=$NG_HOME/temp/proxy_temp –http-fastcgi-temp-path=$NG_HOME/temp/fastcgi_temp –http-uwsgi-temp-path=$NG_HOME/temp/uwsgi_temp –http-scgi-temp-path=$NG_HOME/temp/scgi_temp –with-rtsig_module –with-select_module –with-poll_module –with-threads –with-file-aio –with-ipv6 –with-http_ssl_module –with-http_spdy_module –with-http_realip_module –with-http_addition_module –with-http_xslt_module –with-http_image_filter_module –with-http_geoip_module –with-http_sub_module –with-http_dav_module –with-http_flv_module –with-http_mp4_module –with-http_gunzip_module –with-http_gzip_static_module –with-http_auth_request_module –with-http_random_index_module –with-http_secure_link_module –with-http_degradation_module –with-http_stub_status_module –with-zlib=$DATA/zlib-1.2.8 –with-openssl=$DATA/openssl-1.0.1m –with-pcre=$DATA/pcre-8.36

make && make install