yyyxxxs 2020-05-29
编译安装Nginx-1.16,安装在/usr/local/nginx
yum -y install zlib zlib-devel openssl openssl-devel pcre pcre-devel gcc gcc-c++ make
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
make && make install
配置
cd /usr/lib/systemd/system
vim nginx.service
cat nginx.service
[Unit]
Description=nginx - high performance web server
Documentation=http://nginx.org/en/docs/
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
PIDFile=/usr/local/nginx/logs/nginx.pid
ExecStartPre=/usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf
ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
输入 systemctl start nginx 启动
添加到开机启动: 输入 systemctl start nginx 启动
查看 此状态 输入 systemctl status nginx.service