查看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设置日志打印post请求参数的方法
Mar 31 Servers
提升Nginx性能的一些建议
Mar 31 Servers
nginx作grpc的反向代理踩坑总结
Jul 07 Servers
使用Nginx搭载rtmp直播服务器的方法
Oct 16 Servers
Nginx stream 配置代理(Nginx TCP/UDP 负载均衡)
Nov 17 Servers
nginx负载功能+nfs服务器功能解析
Feb 28 Servers
使用Docker容器部署rocketmq单机的全过程
Apr 03 Servers
Docker官方工具docker-registry案例演示
Apr 13 Servers
vscode内网访问服务器的方法
Jun 28 Servers
搭建zabbix监控以及邮件报警的超级详细教学
Jul 15 Servers
zabbix 代理服务器的部署与 zabbix-snmp 监控问题
Jul 15 Servers
Win10系统搭建ftp文件服务器详细教程
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
Javascript优化技巧(文件瘦身篇)
2008/01/28 Javascript
jQuery常见开发技巧详细整理
2013/01/02 Javascript
Jquery.addClass始终无效原因分析
2013/09/08 Javascript
把jQuery的类、插件封装成seajs的模块的方法
2014/03/12 Javascript
jquery查找tr td 示例模拟
2014/05/08 Javascript
Javascript仿新浪游戏频道鼠标悬停显示子菜单效果
2015/08/21 Javascript
浅谈js对象的创建和对6种继承模式的理解和遐想
2016/10/16 Javascript
微信小程序 支付功能开发错误总结
2017/02/21 Javascript
Angular.JS内置服务$http对数据库的增删改使用教程
2017/05/07 Javascript
Angular实现的自定义模糊查询、排序及三角箭头标注功能示例
2017/12/28 Javascript
JS实现移动端触屏拖拽功能
2018/07/31 Javascript
jQuery序列化form表单数据为JSON对象的实现方法
2018/09/20 jQuery
elementUI vue this.$confirm 和el-dialog 弹出框 移动 示例demo
2019/07/03 Javascript
微信公众号平台接口开发 菜单管理的实现
2019/08/14 Javascript
javascript实现弹出层效果
2019/12/10 Javascript
JavaScript计算出两个数的差值
2020/03/19 Javascript
[02:16]DOTA2英雄基础教程 干扰者
2014/01/15 DOTA
简述Python中的面向对象编程的概念
2015/04/27 Python
python对数组进行反转的方法
2015/05/20 Python
tensorflow中next_batch的具体使用
2018/02/02 Python
在Pandas中给多层索引降级的方法
2018/11/16 Python
Python3实现爬取简书首页文章标题和文章链接的方法【测试可用】
2018/12/11 Python
对Python发送带header的http请求方法详解
2019/01/02 Python
Python pip安装模块提示错误解决方案
2020/05/22 Python
python用opencv完成图像分割并进行目标物的提取
2020/05/25 Python
python主要用于哪些方向
2020/07/05 Python
CSS3动画之流彩文字效果+图片模糊效果+边框伸展效果实现代码合集
2017/08/18 HTML / CSS
用canvas做一个DVD待机动画的实现代码
2019/04/12 HTML / CSS
丝芙兰巴西官方商城:SEPHORA巴西
2016/10/31 全球购物
房地产开盘策划方案
2014/02/10 职场文书
党的群众路线教育实践活动个人整改措施
2014/10/27 职场文书
银行自荐信范文
2015/03/25 职场文书
Mybatis-Plus进阶分页与乐观锁插件及通用枚举和多数据源详解
2022/03/21 Java/Android
悬疑名作《朋友游戏》动画无字ED宣传片 新角色公开
2022/04/13 日漫
Python OpenGL基本配置方式
2022/05/20 Python
Mysql数据库group by原理详解
2022/07/07 MySQL