查看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搭建rtmp直播服务器实现代码
Mar 31 Servers
Nginx+SpringBoot实现负载均衡的示例
Mar 31 Servers
NGINX 权限控制文件预览和下载的实现原理
Jan 18 Servers
Shell脚本一键安装Nginx服务自定义Nginx版本
Mar 20 Servers
Docker 镜像介绍以及commit相关操作
Apr 13 Servers
nginx lua 操作 mysql
May 15 Servers
详解Nginx的超时keeplive_timeout配置步骤
May 25 Servers
使用Nginx+Tomcat实现负载均衡的全过程
May 30 Servers
利用Apache Common将java对象池化的问题
Jun 16 Servers
Docker与K8s关系介绍不会Docker也可以使用K8s
Jun 25 Servers
Windows Server 2008配置防火墙策略详解
Jun 28 Servers
keepalived + nginx 实现高可用方案
Dec 24 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 获取本机外网/公网IP的代码
2010/05/09 PHP
php版本的cron定时任务执行器使用实例
2014/08/19 PHP
讲解WordPress开发中一些常用的debug技巧
2015/12/18 PHP
PHP模板引擎Smarty内建函数foreach,foreachelse用法分析
2016/04/11 PHP
PHP  实现等比压缩图片尺寸和大小实例代码
2016/10/08 PHP
thinkPHP3.2.2框架行为扩展及demo示例
2018/06/19 PHP
laravel实现一个上传图片的接口,并建立软链接,访问图片的方法
2019/10/12 PHP
php设计模式之策略模式实例分析【星际争霸游戏案例】
2020/03/26 PHP
通过js获取div的background-image属性
2013/10/15 Javascript
jQuery把表单元素变为json对象
2013/11/06 Javascript
Checbox的操作含已选、未选及判断代码
2013/11/07 Javascript
使用原生js封装webapp滑动效果(惯性滑动、滑动回弹)
2014/05/06 Javascript
Node.js中的事件驱动编程详解
2014/08/16 Javascript
利用CSS3在Angular中实现动画
2016/01/15 Javascript
js html css实现复选框全选与反选
2016/10/09 Javascript
jquery对所有input type=text的控件赋值实现方法
2016/12/02 Javascript
微信小程序开发之animation循环动画实现的让云朵飘效果
2017/07/14 Javascript
Web开发使用Angular实现用户密码强度判别的方法
2017/09/27 Javascript
vue全局组件与局部组件使用方法详解
2018/03/29 Javascript
mpvue 如何使用腾讯视频插件的方法
2018/07/16 Javascript
基于vue中keep-alive缓存问题的解决方法
2018/09/21 Javascript
详解JS实现简单的时分秒倒计时代码
2019/04/25 Javascript
vue移动端模态框(可传参)的实现
2019/11/20 Javascript
JS实现打字游戏
2019/12/17 Javascript
解决vuecli3中img src 的引入问题
2020/08/04 Javascript
python3+PyQt5实现拖放功能
2018/04/24 Python
在python中bool函数的取值方法
2018/11/01 Python
Python设计模式之适配器模式原理与用法详解
2019/01/15 Python
Python爬虫防封ip的一些技巧
2020/08/06 Python
html5使用html2canvas实现浏览器截图的示例
2017/08/31 HTML / CSS
html5中svg canvas和图片之间相互转化思路代码
2014/01/24 HTML / CSS
泰国健康和美容服务预订网站:GoWabi
2019/06/03 全球购物
小米乌克兰网上商店:Xiaomi.UA
2019/10/29 全球购物
美国最好的葡萄酒网上商店:Wine Library
2019/11/02 全球购物
信息技术专业个人自我评价
2013/12/11 职场文书
质量月口号
2014/06/20 职场文书