(转载)http://iambin.blogbus.com/logs/62429223.html

经常需要重启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`

最新文章

  1. C# XML技术总结之XDocument 和XmlDocument
  2. XListView刷新
  3. NeHe OpenGL教程 第四十七课:CG顶点脚本
  4. 重温设计模式(三)——职责链模式(chain of responsibility)
  5. 在阿里云 CentOS 服务器(ECS)上搭建 nginx + mysql + php-fpm 环境
  6. c#中的结构与枚举
  7. MockMvc和Mockito之酷炫使用
  8. 快捷键Ctrl+c、Ctrl+d、Ctrl+u、Ctrl+a、Ctrl+e
  9. MTK Android4.0.3 ICS 添加缅甸语Myanmar
  10. MySQL将表a中查询的数据插入到表b中
  11. 在MAC下配置MySQL 5.7 数据库的编码问题
  12. bootstrap快速入门笔记(七)-表格,表单
  13. 全球第一免费开源ERP Odoo Ubuntu最佳开发环境独家首发分享
  14. Python爬虫入门教程 1-100 CentOS环境安装
  15. echarts研究
  16. 利用jstack命令定位占用cpu高的java线程及具体错误代码信息
  17. vue中根据生日计算年龄
  18. 利用目录函数(opendir,readdir,closedir)查找文件个数
  19. MySQL事物系列:1:事物简介
  20. jquery validate使用笔记

热门文章

  1. CentOS 开启GD库
  2. SharePoint2013TimerJob计时器发送邮件
  3. jQuery Ajax无刷新操作
  4. ado.net中的几个对象
  5. javascript变量
  6. python(二)基础
  7. javascript cookie 操作
  8. python使用psutil获取服务器信息
  9. lua中的时间函数
  10. ElasticSearch入门-搜索如此简单