一.安装依赖
sudo yum -y install gcc gcc-c++ automake pcre pcre-devel zlip zlib-devel openssl openssl-devel
二.安装nginx 1.下载源码包
wget http://nginx.org/download/nginx-1.8.1.tar.gz
2.解压
tar -zxvf nginx-1.8.1.tar.gz && cd nginx-1.8.1
3.配置
./configure --prefix=/wwwroot/apps/nginx --sbin-path=/wwwroot/apps/nginx/sbin/nginx --conf-path=/wwwroot/apps/nginx/conf/nginx.conf --error-log-path=/wwwroot/apps/log/error.log --http-log-path=/wwwroot/apps/log/access.log --pid-path=/wwwroot/apps/run/nginx.pid --lock-path=/wwwroot/apps/lock/nginx.lock --user=nginx --group=nginx --with-http_ssl_module --with-http_stub_status_module --with-http_gzip_static_module --http-client-body-temp-path=/wwwroot/apps/nginx/client/ --http-proxy-temp-path=/wwwroot/apps/nginx/proxy/ --http-fastcgi-temp-path=/wwwroot/apps/nginx/fcgi/ --http-uwsgi-temp-path=/wwwroot/apps/nginx/uwsgi --http-scgi-temp-path=/wwwroot/apps/nginx/scgi --with-pcre
4.安装
make && make install
5.启动
/wwwroot/apps/nginx/sbin/nginx