编译安装的nginx开机自启
❶ windows系统下nginx如何开机启动,让nginx以服务形式启动
我就推荐我目前在使用的吧,不知道适不适合你,打字辛苦,希望采纳!
这块环境自带线程守护,还是很稳定的,不会挂掉,就算挂掉也会自己启动的。
你可以用免费的集成环境phpWAMP8.8.8.8n以上的版本,集成了NGinx,自带nginx服务,可以开机启动,还有服务器宕机重启功能,站点管理很牛!可以多个PHP同时运行!
mysql和php可以随意自定义,默认集成了多个mysql和php,压缩包也就几十M,听说还是完整版的,压缩率真强,差不多一个G能压缩到几十M,我也是醉了,很方便好用
还自带一键清除环境阻碍,能清除各种程序占用端口,包括iis占用的端口,也能一键清除,这一点很方便,还有端口解除占用功能,很全面。
❷ fedora17添加nginx开机启动。我试过用etc/rc.local的方法不行,这个版本已废除,每次用
看来大侠是自己编译nginx的,那样的话systemctl的脚本肯定得自己写了
❸ 关于linux开机自动启动服务uwsgi. nginx。 我在/etc/rc.local中增加了
你悔衫需要写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
❹ chkconfig无法识别nginx,如何设置nginx自启
假定你源码安装Nginx:
安装路径是/usr/local/nginx
否则变更下面路径的文件:
########################
nginx="/usr/local/nginx/sbin/nginx"
NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf"
################################
则将下面文件:
#cd /etc/init.d/
#vi nginx
粘贴刚才的内容。检查是不是完整
#chmod +x nginx
#chkconfig add nginx
#chkconfig nginx on
在Centos下是这样。其他类同。
#!/bin/sh
#
#nginx - this script starts and stops the nginx daemin
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /usr/local/nginx/conf/nginx.conf
# pidfile: /usr/local/nginx/logs/nginx.pid
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ "$NETWORKING" = "no" ] && exit 0
nginx="/usr/local/nginx/sbin/nginx"
prog=$(basename $nginx)
NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf"
lockfile=/var/lock/subsys/nginx
start() {
[ -x $nginx ] || exit 5
[ -f $NGINX_CONF_FILE ] || exit 6
echo -n $"Starting $prog: "
daemon $nginx -c $NGINX_CONF_FILE
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}
stop() {
echo -n $"Stopping $prog: "
killproc $prog -QUIT
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
}
restart() {
configtest || return $?
stop
start
}
reload() {
configtest || return $?
echo -n $"Reloading $prog: "
killproc $nginx -HUP
RETVAL=$?
echo
}
force_reload() {
restart
}
configtest() {
$nginx -t -c $NGINX_CONF_FILE
}
rh_status() {
status $prog
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
case "$1" in
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 0
$1
;;
restart|configtest)
$1
;;
reload)
rh_status_q || exit 7
$1
;;
force-reload)
force_reload
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit 0
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}"
exit 2
esac
❺ Nginx配置开机启动 /etc/init.d/nginx
在Nginx官网上的 NGINX Init Scripts 选择启动脚本,我隐陪这里是CentOS系统,选择 Red Hat NGINX Init Script , 将脚本拷贝到/etc/init.d/nginx
仔细观察脚本,脚本里面的nginx的相关路圆携睁径与本机安装的路径不一致。
根据以上路径的不同创建软连接
执行 killall -9 nginx 关橘岁闭nginx服务即可
❻ linux nginx 编译安装的 怎么启动
linux nginx 编译安装的 怎么启动
–prefix=path
定义保存服务器文件的目录。这个目录同时将作用于nginx.conf配置文件中配置的相对路径(但不包括源码库的路径)。默认值为/usr/local/nginx。
–sbin-path=path
设置nginx可执行文件的名称,该名称只在安装期间使用。默认值是prefix/sbin/nginx
–conf-path=path
设置nginx.conf配置文件的名称。如果需要,nginx可以使用不同的配置文件启动,你可以通过命令行参数 -c file启动。默认文件名为prefix/conf/nginx.conf
–pid-path=path
设置nginx.pid文件的名称,nginx.pid用于存储主进程的进程ID。安装后,该文件名称可以在nginx.conf的pid指令中修改。默认为prefix/logs/nginx.pid
–error-log-path=path
设置重要的错误、警告以及诊断文件的名字。安装后,可以通过nginx.conf的error_log指令修改。默认为prefix/logs/error.log
–http-log-path=path
记录主要请求日志的名称,安装后通过access_log指令修改。默认为prefix/logs/access.log
–user=name
设置工作进程的用户名,安装后可以通过user指令修改。默认值为nobody
–group=name
设置工作进程的用户组,安皇后可以通过user指令修改,默认与user相同。
–with-xxx_mole
安装xxx模块,这些模块可以在nginx文档中找到。
–without-xxx_mole
不安装xxx模块(有些模块是默认安装的,如果不想安装,可以通过这个参数屏蔽),这些模块可以在nginx文档中找到。
❼ 怎么关闭nginx开机启动
点击电脑的 开始—运行—msconfig—查看启动项 关闭nginx不就可以了 呵呵
❽ WinSW(Windows service wrapper)开机自启动nginx配置
要部署一个nginx服务到Win平台的服务器上,需要完成nginx服务的注册迹局,启动(开机自动和手动)重启,停止等工作。由于自搏州备己不熟悉PowerShell,所以就只能使用第三方的辅助工具基毁了,这里我选择的是工具WinSW: https://github.com/winsw/winsw 。
注:这里我用的是自己的电脑做的截图 。
浏览器输入localhost观察nginx是否启动,收工:
❾ linux 安装nginx后怎么启动
以Centos为例:
1、6.0以前的版本创建/etc/init.d/nginx启动脚本
/etc/init.d/nginx start即可启动
chkconfig nginx on设置开机自启动
2、7.0需要创建nginx.service放到/usr/lib/systemd/system
systemctl start nginx
systemctl enable nginx
❿ centos7.x设置nginx开机自启动
第一步:进入到/lib/systemd/system/目录
第二步:创建nginx.service文件,并编辑
Description:描述服务
After:描述服务类别
[Service]服务运行参数的设置
Type=forking是后台运行的形式
ExecStart为服务的具体运行命令
ExecReload为重启命令
ExecStop为停止命令
PrivateTmp=True表示给服务分配独立的临时空间
注意:[Service]的启动、重启、停止命令全此源部要求使核绝用绝对路径
[Install]运行级别下服务安装的相关设置,可设置为多用户,即系统运行级别为3
保存退出。
:wq
第三步:加入开机自启动
第四步:服务的启动/停止/刷新配置文件/查看状态
第五步 查看开改扒姿机启动项目
一个常见的错误
Warning: nginx.service changed on disk. Run 'systemctl daemon-reload' to reload units.
直接按照提示执行命令systemctl daemon-reload 即可。