1.Nginx下载
https://nginx.org/en/download.html
2.Nginx依赖包安装
yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel pcre pcre-devel
3.Nginx挂载
./configure --prefix=/usr/local/nginx
4.Nginx编译安装
make make install
5.Nginx开机自启配置
cd /etc/systemd/system
vi nginx.service
[Unit]
Description=nginx service
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/usr/local/nginx/sbin/nginx -s quit
PrivateTmp=true [Install] WantedBy=multi-user.target
6.开机自启
systemctl enable nginx