查看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 相关文章推荐
destoon在各个服务器下设置URL Rewrite(伪静态)的方法
Jun 21 Servers
nginx实现发布静态资源的方法
Mar 31 Servers
Nginx四层负载均衡的配置指南
Jun 11 Servers
Nginx反向代理学习实例教程
Oct 24 Servers
关于Nginx中虚拟主机的一些冷门知识小结
Mar 03 Servers
使用kubeadm命令行工具创建kubernetes集群
Mar 31 Servers
配置Kubernetes外网访问集群
Mar 31 Servers
Tomcat starup.bat 脚本实现开机自启动
Apr 20 Servers
nginx 配置缓存
May 11 Servers
docker 制作mysql镜像并自动安装
May 20 Servers
超越Nginx的Web服务器caddy优雅用法
Jun 21 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将fileterms函数返回的结果变成可读的形式
2011/04/21 PHP
fgetcvs在linux的问题
2012/01/15 PHP
zf框架db类的分页示例分享
2014/03/14 PHP
php使用curl伪造来源ip和refer的方法示例
2018/05/08 PHP
Laravel如何创建服务器提供者实例代码
2019/04/15 PHP
Laravel等框架模型关联的可用性浅析
2019/12/15 PHP
laravel 框架执行流程与原理简单分析
2020/02/01 PHP
javascript编程起步(第五课)
2007/01/10 Javascript
JavaScript定义类或函数的几种方式小结
2011/01/09 Javascript
Prototype源码浅析 String部分(四)之补充
2012/01/16 Javascript
关于JQuery($.load)事件的用法和分析
2013/04/09 Javascript
IE与FF下javascript获取网页及窗口大小的区别详解
2014/01/14 Javascript
Javascript 构造函数详解
2014/10/22 Javascript
浅谈下拉菜单中的Option对象
2015/05/10 Javascript
js实现新浪微博首页效果
2015/10/16 Javascript
jQuery实现Tab选项卡切换效果简单演示
2015/11/23 Javascript
bootstrap模态框跳转到当前模板页面 框消失了而背景存在问题的解决方法
2020/11/30 Javascript
jQGrid Table操作列中点击【操作】按钮弹出按钮层的实现代码
2016/12/05 Javascript
原生Aajax 和jQuery Ajax 写法个人总结
2017/03/24 jQuery
Angular.js通过自定义指令directive实现滑块滑动效果
2017/10/13 Javascript
20行JS代码实现粘贴板复制功能
2018/02/06 Javascript
Vue 中axios配置实例详解
2018/07/27 Javascript
微信小程序页面缩放式侧滑效果的实现代码
2018/11/15 Javascript
详解基于node.js的脚手架工具开发经历
2019/01/28 Javascript
研究Python的ORM框架中的SQLAlchemy库的映射关系
2015/04/25 Python
Apache如何部署django项目
2017/05/21 Python
微信浏览器左上角返回按钮拦截功能
2017/11/21 HTML / CSS
悬挂训练绳:TRX
2017/12/14 全球购物
安全生产先进个人材料
2014/02/06 职场文书
《孙子兵法》:欲成大事者,需读懂这些致胜策略
2019/08/23 职场文书
Nginx反向代理及负载均衡如何实现(基于linux)
2021/03/31 Servers
python实现批量提取指定文件夹下同类型文件
2021/04/05 Python
Python进阶学习之带你探寻Python类的鼻祖-元类
2021/05/08 Python
分享Python获取本机IP地址的几种方法
2022/03/17 Python
python中Pyqt5使用Qlabel标签播放视频
2022/04/22 Python
Windows Server 2016 配置 IIS 的详细步骤
2022/04/28 Servers