查看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 Rewrite使用场景及配置方法解析
Apr 01 Servers
Nginx已编译的nginx-添加新模块
Apr 01 Servers
Nginx源码编译安装过程记录
Nov 17 Servers
Nginx配置https的实现
Nov 27 Servers
Nginx虚拟主机的搭建的实现步骤
Jan 18 Servers
Nginx 反向代理解决跨域问题多种情况分析
Jan 18 Servers
阿里云日志过滤器配置日志服务
Apr 09 Servers
在Docker容器中部署SQL Server
Apr 11 Servers
详解如何使用Nginx解决跨域问题
May 06 Servers
Apache SeaTunnel实现 非CDC数据抽取
May 20 Servers
使用Apache Camel表达REST服务的方法
Jun 10 Servers
Windows Server 修改远程桌面端口的实现
Jun 25 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
封装一个PDO数据库操作类代码
2009/09/09 PHP
php中并发读写文件冲突的解决方案
2013/10/25 PHP
PHP递归删除目录几个代码实例
2014/04/21 PHP
让ThinkPHP支持大小写url地址访问的方法
2014/10/31 PHP
PHP向浏览器输出内容的4个函数总结
2014/11/17 PHP
PHP使用array_multisort对多个数组或多维数组进行排序
2014/12/16 PHP
必须收藏的php实用代码片段
2016/02/02 PHP
Laravel统计一段时间间隔的数据方法
2019/10/09 PHP
laravel清除视图缓存的代码
2019/10/23 PHP
js 如何实现对数据库的增删改查
2012/11/23 Javascript
如何编写高质量JS代码
2014/12/28 Javascript
AngularJs根据访问的页面动态加载Controller的解决方案
2015/02/04 Javascript
javascript实现树形菜单的方法
2015/07/17 Javascript
Vue.js 2.0 和 React、Augular等其他前端框架大比拼
2016/10/08 Javascript
Bootstrap中定制LESS-颜色及导航条(推荐)
2016/11/21 Javascript
Vue.js学习记录之在元素与template中使用v-if指令实例
2017/06/27 Javascript
详解nodejs的express如何自动生成项目框架
2017/07/12 NodeJs
浅谈mint-ui 填坑之路
2017/11/06 Javascript
JS计算距当前时间的时间差实例
2017/12/29 Javascript
react native 仿微信聊天室实例代码
2019/09/17 Javascript
js实现验证码干扰(静态)
2021/02/22 Javascript
Python之Web框架Django项目搭建全过程
2017/05/02 Python
python matplotlib实现双Y轴的实例
2019/02/12 Python
搞定这套Python爬虫面试题(面试会so easy)
2019/04/03 Python
Python计算IV值的示例讲解
2020/02/28 Python
Keras 实现加载预训练模型并冻结网络的层
2020/06/15 Python
python 求两个向量的顺时针夹角操作
2021/03/04 Python
俄罗斯街头服装品牌:Black Star Wear
2017/03/01 全球购物
英国最大的手表网站:The Watch Hut
2017/03/31 全球购物
建筑行业的大学生自我评价
2013/12/08 职场文书
《凡卡》教学反思
2014/04/09 职场文书
买卖合同纠纷代理词
2015/05/25 职场文书
管理者日常工作必备:22条企业管理流程模板!
2019/07/12 职场文书
vue3中的组件间通信
2021/03/31 Vue.js
idea编译器vue缩进报错问题场景分析
2021/07/04 Vue.js
Javascript设计模式之原型模式详细
2021/10/05 Javascript