关于Linux开机自动启动服务uwsgi. nginx。 我在/etc/rc.local中增加了

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了关于Linux开机自动启动服务uwsgi. nginx。 我在/etc/rc.local中增加了相关的知识,希望对你有一定的参考价值。

关于Linux开机自动启动服务uwsgi. nginx。 我在/etc/rc.local中增加了 /etc/init.d/nginx restart 和 uwsgi -x /django.xml 开机之后只有前面一个服务开启了,后面一个没有。求解啊。。。。

参考技术A 你需要写uwsgi命令的绝对路径,例如/usr/bin/uwsgi -x /django.xml
方法:
1.找到uwsgi文件。
locate uwsgi

find / -name 'uwsgi'
2.写绝对路径到rc.local文件中

如果你对linux命令熟悉且uwsgi在你的环境变量$PATH目录下的话,你可以在/etc/rc.d/rc.local中增加
source `which uwsgi` -x /django.xml
`是反引号

你可以搜索source本回答被提问者采纳
参考技术B nginx是源码安装的吗?你的系统是什么centos6还是7
复制下面代码自己修改确定nginx安装位置,到/etc/init.d/nginx
#!/bin/bash
# chkconfig: - 99 98
#description: nginx is a World Wide Web server. It is used to serve
nginx="/usr/local/nginx/sbin/nginx"
nginxpid="/usr/local/nginx/nginx.pid"
php="/usr/local/php/sbin/php-fpm"
phppid="/usr/local/php/var/run/php-fpm.pid"
case $1 in
start)
$nginx
$php
echo "nginx php-fpm up"
;;
stop)
kill -s QUIT $(cat nginxpid)
kill -s QUIT $(cat phppid)
echo "nginx php done"
;;
restart)
$0 stop &>/dev/null
$0 start &>/dev/null
echo " restart is ok"
;;
reload)
kill -s HUP $(cat $stop)
echo "reload ok"
;;
*)
echo "error"
echo "start|stop|restart|reload"
esac
6.5版本的话启动service nginx start

开机启动chkconfig nginx on

7.0的话 systemctl start nginx
systemctl enable nginx

然后就可以启动啦!纯手打!
参考技术C uwsgi 这个命令用绝对路径(完整路径),不要直接一个uwsgi

以上是关于关于Linux开机自动启动服务uwsgi. nginx。 我在/etc/rc.local中增加了的主要内容,如果未能解决你的问题,请参考以下文章

求教关于Centos 7开机自动启动脚本 问题。

CentOS开机自动启动脚本

linux怎么设置服务开机自动启动

linux设置开机服务自动启动/关闭自动启动命令

linux 高手进,关于vncserver,我在setup选项里选择了开机自动驱动,请问怎么在验证这个服务正在运行中?

详解django+Nginx+uwsgi 云服务器项目部署