cat <<EOF > /usr/lib/systemd/system/nginx.service [Unit] Description=nginx - web server 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=/usr/local/nginx/sbin/nginx -s reload ExecStop=/usr/local/nginx/sbin/nginx -s stop ExecQuit=/usr/local/nginx/sbin/nginx -s quit PrivateTmp=true [Install] WantedBy=multi-user.target EOF chmod +x /usr/lib/systemd/system/nginx.service systemctl daemon-reload systemctl start nginx.service systemctl enable nginx
本站文章如无特殊说明,均为本站原创,如若转载,请注明出处:centos7.7 添加nginx服务 - Python技术站