nginx的源码编译安装
环境:centos7
ningx版本:nginx-1.8.0.tar.gz
首先安装nginx编译时候的依赖:
yum -y install zlib zlib-devel pcre pcre-devel gcc gcc-c++ openssl openssl-devel libevent libevent-devel perl unzip net-tools wget
tar xf nginx-1.8.0.tar.gz -C /usr/local/ 解压源码包到/usr/local目录下
cd /usr/local/nginx-1.8.0/
./configure \
--prefix=/usr/local/nginx \
--pid-path=/var/run/nginx/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--with-http_gzip_static_module \
--http-client-body-temp-path=/var/temp/nginx/client \
--http-proxy-temp-path=/var/temp/nginx/proxy \
--http-fastcgi-temp-path=/var/temp/nginx/fastcgi \
--http-uwsgi-temp-path=/var/temp/nginx/uwsgi \
--http-scgi-temp-path=/var/temp/nginx/scgi
7.make
8.make install
9.mkdir -pv /var/temp/nginix/client 创建此目录,否则nginx启动不了
10.cd /usr/local/nginx/sbin
11../nginx 启动nginx
12.netstat -tnlp 查看nginx是否启动