1.下载 http://nginx.org/en/download.html
2.解压 tar -zxvf xxxx.tar.gz
3.安装依赖
yum install gcc-c++
yum install pcre-devel
yum install zlib-devel
4.安装
./configure --prefix=/opt/nginx --with-http_ssl_module
or
sudo ./configure --prefix=/opt/nginx --with-openssl=/usr/bin/openssl
sudo make
sudo make install
5.服务
sudo vim /usr/lib/systemd/system/nginx.service
[Unit]
Description=The nginx HTTP and reverse proxy server
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
PIDFile=/opt/nginx/logs/nginx.pid
ExecStartPre=/usr/bin/rm -f /opt/nginx/logs/nginx.pid
ExecStartPre=/opt/nginx/sbin/nginx -t
ExecStart=/opt/nginx/sbin/nginx
ExecReload=/bin/kill -s HUP $MAINPID
KillSignal=SIGQUIT
TimeoutStopSec=5
KillMode=process
PrivateTmp=true
[Install]
WantedBy=multi-user.target