(转载)一句简单命令重启nginx - [nginx]
经常需要重启nginx,但网上的很多教程都需要繁琐的启动脚本,远不如apache的重启命令那么简单。
但研究了一下nginx帮助后发现,有-s参数可对nginx服务进行管理:
# /usr/local/nginx/sbin/nginx -h
nginx version: nginx/0.7.63
Usage: nginx [-?hvVt] [-s signal] [-c filename] [-p prefix] [-g directives]
Options:
-?,-h : this help
-v : show version and exit
-V : show version and configure options then exit
-t : test configuration and exit
-s signal : send signal to a master process: stop, quit, reopen, reload
-p prefix : set prefix path (default: /usr/local/nginx/)
-c filename : set configuration file (default: conf/nginx.conf)
-g directives : set global directives out of configuration file
于是我执行
# /usr/local/nginx/sbin/nginx -s reload
nginx已经重启成功
Nginx由于没有免费的控制面板支持,所以需要修改 /usr/local/nginx/conf/nginx.conf 这个文件来实现服务器性能、特性的配置。
上传下载配置文件建议使用Winscp这个工具,同样基于SSH协议,比Ftp安全。
在 http://wiki.nginx.org/NginxConfiguration 有很多配置文件的文档和例子。
默认的配置文件也不错,有以下几点需要注意:
- 每次修改配置文件并上传后,需要测试配置文件是否正确,命令如下:
/usr/local/nginx/sbin/nginx -t
- 修改配置后,必须重启Nginx才能生效,Nginx进程无缝重启命令如下:
kill -HUP `cat /usr/local/nginx/logs/nginx.pid`
最新文章
- C# XML技术总结之XDocument 和XmlDocument
- XListView刷新
- NeHe OpenGL教程 第四十七课:CG顶点脚本
- 重温设计模式(三)——职责链模式(chain of responsibility)
- 在阿里云 CentOS 服务器(ECS)上搭建 nginx + mysql + php-fpm 环境
- c#中的结构与枚举
- MockMvc和Mockito之酷炫使用
- 快捷键Ctrl+c、Ctrl+d、Ctrl+u、Ctrl+a、Ctrl+e
- MTK Android4.0.3 ICS 添加缅甸语Myanmar
- MySQL将表a中查询的数据插入到表b中
- 在MAC下配置MySQL 5.7 数据库的编码问题
- bootstrap快速入门笔记(七)-表格,表单
- 全球第一免费开源ERP Odoo Ubuntu最佳开发环境独家首发分享
- Python爬虫入门教程 1-100 CentOS环境安装
- echarts研究
- 利用jstack命令定位占用cpu高的java线程及具体错误代码信息
- vue中根据生日计算年龄
- 利用目录函数(opendir,readdir,closedir)查找文件个数
- MySQL事物系列:1:事物简介
- jquery validate使用笔记