背景
想把服务器上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 ......
总结
以上为个人经验,希望能给大家一个参考,也希望大家多多支持代码网。
发表评论