nginx启动、开机自启动、重启、关闭
yum -y install nginx
# yum info nginx
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyuncs.com
* epel: mirrors.aliyuncs.com
* extras: mirrors.aliyuncs.com
* updates: mirrors.aliyuncs.com
Installed Packages
Name : nginx
Arch : x86_64
Epoch :
Version : 1.10.
Release : .el7
Size : 1.4 M
Repo : installed
From repo : epel
Summary : A high performance web server and reverse proxy server
URL : http://nginx.org/
License : BSD
Description : Nginx is a web server and a reverse proxy server for HTTP, SMTP, POP3 and
: IMAP protocols, with a strong focus on high concurrency, performance and low
: memory usage.
yum -y uninstall nginx
一、启动
cd /usr/local/nginx/sbin
./nginx
开机自启动:
cat /etc/rc.d/rc.local #!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot. touch /var/lock/subsys/local
/usr/local/nginx/sbin/nginx
直接把启动应用程序的命令放在这个文件中就可以了
二、重启
更改配置重启nginx
kill -HUP 主进程号或进程号文件路径
或者使用
cd /usr/local/nginx/sbin
./nginx -s reload
判断配置文件是否正确
nginx -t -c /usr/local/nginx/conf/nginx.conf
或者
cd /usr/local/nginx/sbin
./nginx -t
三、关闭
查询nginx主进程号
ps -ef | grep nginx
从容停止 kill -QUIT 主进程号
快速停止 kill -TERM 主进程号
强制停止 kill -9 nginx
若nginx.conf配置了pid文件路径,如果没有,则在logs目录下
kill -信号类型 '/usr/local/nginx/logs/nginx.pid'
四、升级
1、先用新程序替换旧程序文件
2、kill -USR2 旧版程序的主进程号或者进程文件名
此时旧的nginx主进程会把自己的进程文件改名为.oldbin,然后执行新版nginx,此时新旧版本同时运行
3、kill -WINCH 旧版本主进程号
4、不重载配置启动新/旧工作进程
kill -HUP 旧/新版本主进程号
从容关闭旧/新进程
kill -QUIT 旧/新进程号
快速关闭旧/新进程
kill -TERM 旧/新进程号
http://www.cnblogs.com/jianxie/p/3990377.html
nginx启动、开机自启动、重启、关闭的更多相关文章
- nginx设置开机自启动
每次启动nginx服务都需要到安装目录下的/sbin下面,感觉挺麻烦的. 下面介绍一下如何在Linux(CentOS)系统上,设置nginx开机自启动. 1 用脚本管理nginx服务 第一步:在/et ...
- nginx启动、停止重启
启动 启动代码格式:nginx安装目录地址 -c nginx配置文件地址 例如: [root@LinuxServer sbin]# /usr/local/nginx/sbin/nginx -c /us ...
- NO19 优化Linux系统--重要开机自启动服务--关闭自启动项
**如何优化Linux系统: 1 不用root,添加普通用户,通过sudo授权管理.2 更改默认的远程连接SSH服务端口及禁止root用户远程连接.3 定时自动更新服务器时间.4 配置 ...
- nginx加入开机自启动
1.首先,在linux系统的/etc/init.d/目录下创建nginx文件,使用如下命令:(vim /etc/init.d/nginx) 2.在/etc/init.d/nginx中写入以下脚本代码 ...
- 配置nginx脚本开机自启动
vi /etc/init.d/nginx 插入以下内容,修改红色字体自己安装路径 #!/bin/bash## chkconfig: - 85 15# description: Nginx is a W ...
- Windows下nginx设置开机自启动
第一步:下载 WinSW https://github.com/winsw/winsw/releases/download/v2.10.3/WinSW.NET4.exe 64位系统 https://g ...
- Windows 安装nginx并开机启动
Win安装nginx并 开机启动 下载nginx安装包 nginx-1.12.2.zip,解压到D盘. https://pan.baidu.com/s/1InQa527yq35Q68c73RBb-A# ...
- CentOS7.X中设置nginx和php-fpm的开机自启动
一.设置nginx的开机自启动方法 1.在/etc/init.d/目录下创建nginx文件 vi /etc/init.d/nginx 编写内容如下: #!/bin/sh # # nginx - thi ...
- 虚拟机拷贝之后,发现系统内的开机自启动的nginx,不能自启动了
因业务需要,同事以某个虚拟机为模板,复制出其他的CentOS虚拟机时,发现原系统内的开机自启动的nginx,不能再自启动了. 好吧,那就重新注册一下 nginx 的开机自启动: # 先删除原来的注册: ...
- 编写shell脚本让springboot项目在CentOS中开机自启动
springboot项目部署在CentOS系统上时,如果遇到停电关机,公司的实施人员就得跑到甲方现场重新启动项目并测试,很是麻烦,这里探讨如何编写shell脚本控制springboot项目开机时自动启 ...
随机推荐
- web开发 - 从零开始 - 03 - 选择器
行间样式>id>class>类型选择>通配符 选择器的优先级一致的情况下,后边的样式会覆盖前边的
- Deep Learning(深度学习)学习笔记整理系列之(八)
Deep Learning(深度学习)学习笔记整理系列 zouxy09@qq.com http://blog.csdn.net/zouxy09 作者:Zouxy version 1.0 2013-04 ...
- R与数据分析旧笔记(十五) 基于有代表性的点的技术:K中心聚类法
基于有代表性的点的技术:K中心聚类法 基于有代表性的点的技术:K中心聚类法 算法步骤 随机选择k个点作为"中心点" 计算剩余的点到这个k中心点的距离,每个点被分配到最近的中心点组成 ...
- AXIS2远程调用WebService示例(Eclipse+AXIS)
转自:http://www.cnblogs.com/lanxuezaipiao/archive/2013/05/10/3071584.html 我们将Web Service发布在Tomcat或者其他应 ...
- 转载[WampServer下使用多端口访问]
作者:韩子迟 原文链接:http://www.cnblogs.com/zichi/p/4589142.html 注意点:www和www2都需要安装服务: 在C:\wamp\bin\apache\Apa ...
- ORA-01045: user XXZY lacks CREATE SESSION privilege; logon denied
在创建用户时,一般我们都分配connect.dba.resource 角色,但是,为什么登陆时还报错呢 原因:用户角色没有激动 解决:ALTER USER XXXX DEFAULT ROLE &quo ...
- shell实现死循环
参考自http://codingstandards.iteye.com/blog/780524 .while true do command; done .while : do command; do ...
- ora-01653: unable to extend table sys.aud$ by 8192 in tablespac system[转载]
在用sqlplus user/password@truth登录数据库时报如下错误:ORA-00604: error occurred at recursive SQL level 1ORA-01653 ...
- 基于视觉信息的网页分块算法(VIPS) - yysdsyl的专栏 - 博客频道 - CSDN.NET
基于视觉信息的网页分块算法(VIPS) - yysdsyl的专栏 - 博客频道 - CSDN.NET 于视觉信息的网页分块算法(VIPS) 2012-07-29 15:22 1233人阅读 评论(1) ...
- Linux下smi/mdio总线驱动
Linux下smi/mdio总线驱动 韩大卫@吉林师范大学 MII(媒体独立接口), 是IEEE802.3定义的以太网行业标准接口, smi是mii中的标准管理接口, 有两跟管脚, mdio 和mdc ...