1、首先添加組
groupadd -r nginx
useradd -g nginx -r nginx
2、解壓源碼包:
tar xf nginx-1.6.3.tar.gz
cd nginx-1.6.3
./configure --prefix=/usr/local/nginx --conf-path=/etc/nginx/nginx.conf --user=nginx --group=nginx --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx/nginx.pid --lock-path=/var/lock/nginx.lock --with-http_ssl_module --with-http_stub_status_module --with-http_gzip_static_module --with-http_flv_module --with-http_mp4_module --http-client-body-temp-path=/var/tmp/nginx/client --http-proxy-temp-path=/var/tmp/nginx/proxy --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi
3、注意臨時文件的存放路勁要手動創建
mkdir -pv /var/tmp/nginx/{client,fastcgi,proxy,uvsgi}
添加環境變量
vim /etc/profile.d/nginx.sh
export PATH=/usr/local/nginx/sbin:$PATH
重讀環境變量
. /etc/profile.d/nginx.sh
啓動nginx
/usr/local/nginx/sbin/nginx
啓動時報錯