Failed to Stop or Restart Nginx Server Through Serevice Command(nginx进程不能停止重启)
Many people are accustomed to start a Nginx web server through init scripts and then they can control the state of the server through service command, such as sudo service nginx restart. But sometimes unobvious config error makes the scripts failed to work. Here I will show an error related to pid directive in the config file of nginx, which defaultly located at /opt/nginx/conf/nginx.conf.
As ignored by many people, some init scripts assump there is a pid file of nginx located at /var/run/nginx.pid, but in the fact, the default pid file for nginx is /opt/nginx/logs/nginx.pid. Because the scripts can’t get the correct pid or even get nothing, they failed to stop the nginx process, some tasks dependent on it will be failed too, for example, you are not able to restart the server.
To resolve this problem, you need to:
- Force terminating your server through:
|
- Open your nginx config file to edit:
|
- Specify the path of your pid file:
|
- After saving your change, start your server now:
|
- To confirm that your pid config has taken effect, you can cat your pid file and/or try to restart your server through
servicecommand:
|
As expected, you will see the screen out “OK” for your operations.
Failed to Stop or Restart Nginx Server Through Serevice Command(nginx进程不能停止重启)的更多相关文章
- Setting up Django and your web server with uWSGI and nginx
https://uwsgi.readthedocs.io/en/latest/tutorials/Django_and_nginx.html Setting up Django and your we ...
- [r]Setting up Django and your web server with uWSGI and nginx
Setting up Django and your web server with uWSGI and nginx This tutorial is aimed at the Django user ...
- 配置 nginx server 出现nginx: [emerg] "root" directive is duplicate in /etc/nginx/server/blogs.conf:7
在配置nginx 虚拟机时,执行 sudo /usr/sbin/nginx -t 报下面的错误: nginx: [emerg] nginx: configuration file /etc/nginx ...
- 把Nginx加为系统服务(service nginx start/stop/restart)
1.编写脚本,名为nginx #!/bin/sh # # nginx - this script starts and stops the nginx daemon # # chkconfig: - ...
- How To Set Up Nginx Server Blocks (Virtual Hosts) on Ubuntu
sudo apt-get update sudo apt-get install nginxsudo mkdir -p /var/www/example.com/html sudo chown -R ...
- TinyCore Nginx server with php-cgi and vsftpd
http://blog.matchgenius.com/tinycore-nginx-server-with-php-cgi-and-vsftpd/ Create fast testing serve ...
- nginx Server names
通配符名称 正則表達式名称 混合名称 优化 兼容性 server名称定义使用的server_name指令和决定哪个server块用于一个给定的请求. 參见"怎样Nginx处理一个请求&quo ...
- nginx的开机自启、server命令启动、nginx.conf配置
1.将Nginx设置为开机自动启动 a.当上面6步完成之后,说明安装已经完全成功了,但是每次开机我们面临的一个问题,就是每次都要执行命令(1: cd /usr/local/nginx/sbin/ ...
- 用Keepalived搭建双Nginx server集群,防止单点故障
综述: 浏览器访问虚拟IP: 192.168.1.57, 该虚拟IP被Keepalived接管,两个Keepalived进程分别运行在物理IP为192.168.1.56和192.168.1.59服务器 ...
随机推荐
- magento 开启模板路径提示
1.进入后台system->configuration->,选择main Website 2.advanced->developer中,将Debug中的Template Path H ...
- BZOJ 3224: Tyvj 1728 普通平衡树 or 洛谷 P3369 【模板】普通平衡树-Splay树模板题
3224: Tyvj 1728 普通平衡树 Time Limit: 10 Sec Memory Limit: 128 MBSubmit: 22483 Solved: 10130[Submit][S ...
- UVA 11636.Hello World!-水题
Hello World! Time limit: 1.000 seconds When you first made the computer to print the sentence “Hello ...
- RabbitMQ (六) 订阅者模式之路由模式 ( direct )
路由模式下,生产者发送消息时需要指定一个路由键(routingKey),交换机只会把消息转发给包含该路由键的队列 这里,我们改变一下声明交换机的方式. 我们通过管理后台添加一个交换机. 添加后,生产者 ...
- 一条命令搞定在VMware中的Ubuntu14.04 64 位安装Docker
对,就是这么炫酷! curl -sSL https://get.docker.com/ | sudo sh 如果提示没有装curl就apt-get install一下,另外提醒一下必须是64位的ubu ...
- luogu P1855 榨取kkksc03
题目描述 以下皆为真实的故事. 洛谷2的团队功能是其他任何oj和工具难以达到的.借助洛谷强大的服务器资源,任何学校都可以在洛谷上零成本的搭建oj并高效率的完成训练计划. 为什么说是搭建oj呢?为什么高 ...
- [LOJ6436]神仙的游戏
感觉border的性质还是挺神奇的 一个border的性质是$S$有长度为$len$的border当且仅当对$\forall i\equiv j\left(\bmod(n-len)\right)$有$ ...
- python操作mysql封装成类
import pymysqlimport loggingimport sys # 加入日志#获取logger实例logger = logging.getLogger("baseSpider& ...
- Atom | 报错 Cannot load the system dictionary for zh-CN的解决办法
文章目录 问题描述 推荐阅读 查找问题所在 解决方案 (二选一) 问题描述 最近这款优秀的编辑器 atom,报错 Cannot load the system dictionary for zh-CN ...
- awk-使用
http://www.cnblogs.com/ggjucheng/archive/2013/01/13/2858470.html 命令格式: awk [-F field-separator] 'pat ...