linux配置nginx

相关命令:

nginx -s reload  :修改配置后重新加载生效
nginx -s reopen  :重新打开日志文件
nginx -t -c /path/to/nginx.conf 测试nginx配置文件是否正确

关闭nginx:
nginx -s stop  :快速停止nginx
         quit  :完整有序的停止nginx

其他的停止nginx 方式:

ps -ef | grep nginx

kill -QUIT 主进程号     :从容停止Nginx
kill -TERM 主进程号     :快速停止Nginx
pkill -9 nginx          :强制停止Nginx
 
service nginx start 开启
service nginx stop 停止
service nginx restart 重启

启动nginx:
nginx -c /path/to/nginx.conf

平滑重启nginx:
kill -HUP 主进程号
 
如果配置多个域名,除了子default.conf配置多行之外,可以在 /etc/nginx/conf.d/ 目录下配置多个域名结尾的配置文件,如www.baidu.com的域名就配置为www.baidu.com.conf。
原文地址:https://www.cnblogs.com/azhqiang/p/6430364.html