步骤
以服务名pano为例.
vim /usr/lib/systemd/system/pano.service
- 插入以下文字并保存:
[Unit]
Description=pano - main site of site_name.com
Documentation=http://www.site_name.com/docs/
[Service]
ExecStart=/usr/local/bin/node /www/www.site_name.com/node/bin/www
ExecStop=/bin/kill -s QUIT $MAINPID
Restart=always
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=nobody
User=nobody
Group=nobody
Environment=NODE_ENV=production
[Install]
WantedBy=multi-user.target
- 重载服务
systemctl enable pano
systemctl start pano