查看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 相关文章推荐
Windows下用Nginx配置https服务器及反向代理的问题
Sep 25 Servers
使用 Apache 反向代理的设置技巧
Jan 18 Servers
详解nginx location指令
Jan 18 Servers
为Centos安装指定版本的Docker
Apr 01 Servers
Docker官方工具docker-registry案例演示
Apr 13 Servers
nginx搭建NFS网络文件系统
Apr 14 Servers
nginx容器方式反向代理实战
Apr 18 Servers
Windows Server 2012 R2 磁盘分区教程
Apr 29 Servers
阿里云国际版 使用Nginx作为HTTPS转发代理服务器
May 11 Servers
Linux磁盘管理方法介绍
Jun 01 Servers
教你nginx跳转配置的四种方式
Jul 07 Servers
Nginx如何获取自定义请求header头和URL参数详解
Jul 23 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
php5 non-thread-safe和thread-safe这两个版本的区别分析
2010/03/13 PHP
php URL跳转代码 减少外链
2011/06/25 PHP
PHP循环语句笔记(foreach,list)
2011/11/29 PHP
详解PHP中foreach的用法和实例
2016/10/25 PHP
js下获取div中的数据的原理分析
2010/04/07 Javascript
基于jquery的loading效果实现代码
2010/11/05 Javascript
javascrip关于继承的小例子
2013/05/10 Javascript
JS判断字符串长度的5个方法(区分中文和英文)
2014/03/18 Javascript
JS获取客户端IP地址、MAC和主机名的7个方法汇总
2014/07/21 Javascript
jQuery修改li下的样式以及li下的img的src的值的方法
2014/11/02 Javascript
纯javascript实现图片延时加载方法
2015/08/21 Javascript
js显示当前日期时间和星期几
2015/10/22 Javascript
javascript入门之window对象【新手必看】
2016/11/22 Javascript
浅析Jquery操作select
2016/12/13 Javascript
微信页面倒计时代码(解决safari不兼容date的问题)
2016/12/13 Javascript
vue技术分享之你可能不知道的7个秘密
2018/04/09 Javascript
使用vue-router为每个路由配置各自的title
2018/07/30 Javascript
VUE解决 v-html不能触发点击事件的问题
2019/10/28 Javascript
JavaScript面向对象核心知识与概念归纳整理
2020/05/09 Javascript
python list语法学习(带例子)
2013/11/01 Python
python中from module import * 的一个坑
2014/07/20 Python
Python实现 PS 图像调整中的亮度调整
2019/06/28 Python
python实现四人制扑克牌游戏
2020/04/22 Python
利用Python将图片中扭曲矩形的复原
2020/09/07 Python
浅谈HTML5中dialog元素尝鲜
2018/10/15 HTML / CSS
canvas 基础之图像处理的使用
2020/04/10 HTML / CSS
html5用video标签流式加载的实现
2020/05/20 HTML / CSS
澳大利亚设计的优质鞋类和适合澳大利亚生活方式的服装:Rivers
2019/04/23 全球购物
2014年自我评价
2014/01/04 职场文书
群众路线教师自我剖析材料
2014/09/29 职场文书
医生见习报告范文
2014/11/03 职场文书
校长师德表现自我评价
2015/03/05 职场文书
幼儿园托班开学寄语(2015秋季)
2015/05/27 职场文书
社区安全温馨提示语
2015/07/14 职场文书
2019新员工试用期转正工作总结范文
2019/08/21 职场文书
2020年元旦祝福语录,总有适合你的
2019/12/31 职场文书