nginx AWS EC2重新启动-启动脚本无法使用pm2

wgx48brx  于 2023-08-03  发布在  Nginx
关注(0)|答案(1)|浏览(138)

每当EC2重启发生时,我想启动nginx服务沿着其他几个node js应用程序。
我创建了rc.local
我添加了下面的代码行:

#/etc/startup_script.sh
#actual path to your script file.
/usr/bin/bash /etc/startup_script.sh &
exit 0

字符串
startup_script.sh:

sudo systemctl start nginx.service

#start pm2 services
pm2 start npm --name node_server1
pm2 start npm --name node_server2
pm2 start npm --name node_server3
pm2 start npm --name node_server4

pm2 save


获取以下错误

-- Reboot --
Jul 25 14:30:00 ip-10-192-3-238 systemd[1]: Starting /etc/rc.local Compatibility...
Jul 25 14:30:00 ip-10-192-3-238 systemd[1]: rc-local.service: Control process exited, code=exited, status=203/EXEC
Jul 25 14:30:00 ip-10-192-3-238 systemd[1]: rc-local.service: Failed with result 'exit-code'.
Jul 25 14:30:00 ip-10-192-3-238 systemd[1]: Failed to start /etc/rc.local Compatibility.

yr9zkbsy

yr9zkbsy1#

您需要先将该服务下载到您的Linux机器中:

sudo yum install nginx -y

字符串

相关问题