nginx

关注公众号 jb51net

关闭
首页 > 网站技巧 > 服务器 > nginx > nginx配置文件目录

nginx配置文件目录过程

作者:shuxiaohua

文章介绍了在本地使用VSCode打开Nginx配置文件时发现未指定配置文件目录的问题,通过查看Nginx官网和默认配置文件目录未找到配置文件,最终通过`nginx -V`命令确认了Nginx在编译时指定了配置文件目录

背景

想把服务器上nginx配置文件下载到本地使用vscode打开看的时候,发现进程参数中未指定配置文件目录。

于是查看nginx官网,nginx默认配置文件目录为 /usr/local/nginx/conf, /etc/nginx, or /usr/local/etc/nginx.

然后去上述目录都看一下还是没找到。

解决方案

nginx -t可以查看

配置文件实际使用的目录

nginx: the configuration file /xxxx/nginx.conf syntax is ok
nginx: configuration file /xxxxx/nginx.conf test is successful

nginx -V:当进程未指定配置文件目录

而且nginx默认搜索的配置目录也不存在时,那应该是在编译的时候就指定了配置文件目录。

可以通过nginx -V来确认。

nginx -V能够打印出,编译nginx时,configure命令指定了那些参数。

nginx version: nginx/1.18.0
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC)
built with OpenSSL 1.0.2k-fips  26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=xxx --conf-path=xxxx --user= --group=xxxxx --pid-path=xxxxx/nginx/nginx.pid --error-log-path=xxxx/error.log --http-log-path=xxxxxx/access.log --sbin-path=xxxxxx/nginx
 ......

总结

以上为个人经验,希望能给大家一个参考,也希望大家多多支持脚本之家。

您可能感兴趣的文章:
阅读全文