查看nginx配置文件路径和资源文件路径的方法


Posted in Servers onMarch 31, 2021

查看nginx配置文件路径

通过 nginx -t

nginx -t命令的原始作用是用来验证nginx配置文件格式和配置是否存在异常,通过该命令会输出nginx的配置文件的路径和验证结果,在输出结果中就可以找到当前的nginx的加载的配置文件的地址,如下所示:

nginx -t

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

由此可知nginx的配置文件在 /etc/nginx/nginx.conf这个文件夹下

通过 ps -ef|grep nginx

如果在nginx启动的过程中显式的配置了nginx配置文件的加载路径,通过这样的方式就可以很简单的看到当前的配置文件加载路径

通过 locate 命令来进行查找

如果在服务器中有安装locate命令的话,可以通过 locate nginx.conf 这个命令来进行查找,但是如果存在多个nginx.conf 文件的时候,就很难判断到底加载的是哪一个ngxin配置文件

通过 nginx -V 命令来进行查找

通过nginx -V命令可以看到安装时的所有配置信息,通过查找里面的 --conf-path 这个配置信息,可以找到对应的配置文件的路径,如下所示:

nginx -V

nginx version: nginx/1.12.2
built by gcc 8.2.1 20180905 (Red Hat 8.2.1-3) (GCC) 
built with OpenSSL 1.0.2k-fips 26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --add-module=/usr/local/src/headers-more-nginx-module-0.33 --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/tmp/client_body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --pid-path=/run/nginx.pid --lock-path=/run/lock/subsys/nginx --user=nginx --group=nginx --with-file-aio --with-http_auth_request_module --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module=dynamic --with-http_image_filter_module=dynamic --with-http_geoip_module=dynamic --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_slice_module --with-http_stub_status_module --with-http_perl_module=dynamic --with-mail=dynamic --with-mail_ssl_module --with-pcre --with-pcre-jit --with-stream=dynamic --with-stream_ssl_module --with-debug --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic' --with-ld-opt='-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-E'

查看nginx资源文件路径

通过 nginx -V 命令

通过nginx -V 命令,然后查找命令中返回的 --prefix= 配置,该配置对应的路径便为nginx的资源文件的路径

到此这篇关于查看nginx配置文件路径和资源文件路径的方法的文章就介绍到这了,更多相关nginx配置文件路径内容请搜索三水点靠木以前的文章或继续浏览下面的相关文章希望大家以后多多支持三水点靠木!

Servers 相关文章推荐
nginx 设置多个站跨域
Mar 09 Servers
Windows下使用Nginx+Tomcat做负载均衡的完整步骤
Mar 31 Servers
提升Nginx性能的一些建议
Mar 31 Servers
解析在浏览器地址栏输入一个URL后发生了什么
Jun 21 Servers
制作能在nginx和IIS中使用的ssl证书
Jun 21 Servers
图文详解Nginx版本平滑升级方案
Sep 15 Servers
Tomcat用户管理的优化配置详解
Mar 31 Servers
Nginx+Tomcat负载均衡多实例详解
Apr 11 Servers
Windows Server 2016 配置 IIS 的详细步骤
Apr 28 Servers
Nginx本地配置SSL访问的实例教程
May 30 Servers
Win2008系统搭建DHCP服务器
Jun 25 Servers
windows系统搭建WEB服务器详细教程
Aug 05 Servers
nginx里的rewrite跳转的实现
Mar 31 #Servers
nginx基于域名,端口,不同IP的虚拟主机设置的实现
Mar 31 #Servers
Nginx设置日志打印post请求参数的方法
Mar 31 #Servers
nginx 多个location转发任意请求或访问静态资源文件的实现
nginx简单配置多个server的方法
nginx proxy_cache 缓存配置详解
Nginx搭建rtmp直播服务器实现代码
Mar 31 #Servers
You might like
php 采集书并合成txt格式的实现代码
2009/03/01 PHP
ThinkPHP处理Ajax返回的方法
2014/11/22 PHP
Yii视图CGridView列表用法实例分析
2016/07/12 PHP
PHP实现表单提交时去除斜杠的方法
2016/12/26 PHP
详谈php中 strtr 和 str_replace 的效率问题
2017/05/14 PHP
PHP ADODB实现事务处理功能示例
2018/05/25 PHP
phpinfo无法显示的原因及解决办法
2019/02/15 PHP
利用js获取服务器时间的两个简单方法
2010/01/08 Javascript
jQuery代码优化 选择符篇
2011/11/01 Javascript
jQuery获取Select选择的Text和Value(详细汇总)
2013/01/25 Javascript
jQuery的选择器中的通配符使用介绍
2014/03/20 Javascript
JavaScript中的ubound函数使用实例
2014/11/04 Javascript
AngularJS向后端ASP.NET API控制器上传文件
2016/02/03 Javascript
ES6新特征数字、数组、字符串
2016/10/01 Javascript
vue webuploader 文件上传组件开发
2017/09/23 Javascript
微信小程序中时间戳和日期的相互转换问题
2018/07/09 Javascript
浅谈vue引用静态资源需要注意的事项
2018/09/28 Javascript
js字符串处理之绝妙的代码
2019/04/05 Javascript
python django 访问静态文件出现404或500错误
2017/01/20 Python
pandas带有重复索引操作方法
2018/06/08 Python
详解Python sys.argv使用方法
2019/05/10 Python
django搭建项目配置环境和创建表过程详解
2019/07/22 Python
python实现统计代码行数的小工具
2019/09/19 Python
python绘制彩虹图
2019/12/16 Python
python数据库开发之MongoDB安装及Python3操作MongoDB数据库详细方法与实例
2020/03/18 Python
用Python实现职工信息管理系统
2020/12/30 Python
SheIn俄罗斯:时尚女装网上商店
2017/02/28 全球购物
李维斯牛仔裤荷兰官方网站:Levi’s NL
2020/08/23 全球购物
怎样从/向数据文件读/写结构
2014/11/23 面试题
医药大学生求职简历的自我评价
2013/10/17 职场文书
会计学专业学生的求职信范文
2014/01/27 职场文书
我的祖国演讲稿
2014/05/04 职场文书
幼儿园师德师风学习材料
2014/05/29 职场文书
群众路线查摆问题整改措施
2014/10/10 职场文书
班级联欢会主持词
2015/07/03 职场文书
vue-cli3.0修改打包后的文件名和文件地址,打包后本地运行报错解决
2022/04/06 Vue.js