nginx入门--根据官方文档整理

新手实用教程

配置文件路径

By default, the configuration file is named nginx.conf and placed in the directory /usr/local/nginx/conf, /etc/nginx, or /usr/local/etc/nginx.

启动/停止命令

nginx -s signal
signal代表以下几项:
stop — 快速关闭

quit — 正常关闭,当前工作进程停止对请求提供服务

reload — 重载配置文件
nginx -s reload
重载检查当前新配置文件并应用配置文件,成功则启动新进程并发送信息使得旧进程关闭,否则主进程回滚并使用旧配置继续工作。
Old worker processes, receiving a command to shut down, stop accepting new connections and continue to service current requests until all such requests are serviced. After that, the old worker processes exit.

reopen — 重开日志文件

kill -s QUIT 1628 — 直接发送给进程的信号正常关闭
对于直接发送给进程的信号,拥有一个给定的进程ID,写在 /usr/local/nginx/logs 或者 /var/run中

路径选择

当nginx选择一个location代码块来提供请求地址时,它首先检查指定前缀的位置指令,记住具有最长前缀的位置,然后检查正则表达式。 如果与正则表达式匹配,则nginx选择此位置,否则,它会选择之前记住的那个

使用FastCGI代理

从源构建nginx

配置命令支持的参数

你可能感兴趣的:(nginx入门--根据官方文档整理)