为淘宝的tengine配置systemctl启动

# cat /lib/systemd/system/nginx.service 
[Unit]
Description=The nginx HTTP and reverse proxy server
After=syslog.target network.target remote-fs.target nss-lookup.target
 
[Service]
Type=forking
PIDFile=/run/nginx.pid
ExecStartPre=/usr/local/tengine/sbin/nginx
ExecStart=/usr/local/tengine/sbin/nginx -c /usr/local/tengine/conf/nginx.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
 
[Install]
WantedBy=multi-user.target

# chmod 745 /lib/systemd/system/nginx.service 
# systemctl enable nginx.service
# systemctl start nginx
# systemctl status nginx (如果报错先把之前的nginx杀掉)

你可能感兴趣的:(nginx,服务器,运维)