查看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前后端同域名配置的方法实现
Mar 31 Servers
Nginx的rewrite模块详解
Mar 31 Servers
Nginx服务器添加Systemd自定义服务过程解析
Mar 31 Servers
详解Apache SkyWalking 告警配置指南
Apr 22 Servers
nginx+lua单机上万并发的实现
May 31 Servers
使用nginx配置访问wgcloud的方法
Jun 26 Servers
Nginx实现负载均衡的项目实践
Mar 18 Servers
深入解析Apache Hudi内核文件标记机制
Mar 31 Servers
IIS服务器中设置HTTP重定向访问HTTPS
Apr 29 Servers
nginx实现多geoserver服务的负载均衡
May 15 Servers
使用Apache Camel表达REST服务的方法
Jun 10 Servers
Valheim服务器 Mod修改安装教程 【ValheimPlus】
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
风格模板初级不完全修改教程
2006/10/09 PHP
php文件打包 下载之使用PHP自带的ZipArchive压缩文件并下载打包好的文件
2012/06/13 PHP
php的memcache类分享(memcache队列)
2014/03/26 PHP
php环境套包 dedeampz 伪静态设置示例
2014/03/26 PHP
浅谈PHP中的面向对象OOP中的魔术方法
2017/06/12 PHP
Laravel中服务提供者和门面模式的入门介绍
2017/11/06 PHP
学习ExtJS 访问容器对象
2009/10/07 Javascript
jQuery淡入淡出元素让其效果更为生动
2014/09/01 Javascript
ExpressJS入门实例
2015/01/14 Javascript
js实现三张图(文)片一起切换的banner焦点图
2015/08/25 Javascript
Javascript基础学习笔记(菜鸟必看篇)
2016/07/22 Javascript
EasyUI实现下拉框多选功能
2017/11/07 Javascript
nuxt框架中路由鉴权之Koa和Session的用法
2018/05/09 Javascript
详解BootStrap表单验证中重置BootStrap-select验证提示不清除的坑
2019/09/17 Javascript
layui实现多图片上传并限制上传的图片数量
2019/09/26 Javascript
使用layer弹窗,制作编辑User信息页面的方法
2019/09/27 Javascript
JavaScript find()方法及返回数据实例
2020/04/30 Javascript
详解ES6 扩展运算符的使用与注意事项
2020/11/12 Javascript
[01:02:48]2018DOTA2亚洲邀请赛 4.1 小组赛 A组 LGD vs OG
2018/04/02 DOTA
python 通过logging写入日志到文件和控制台的实例
2018/04/28 Python
pytorch + visdom CNN处理自建图片数据集的方法
2018/06/04 Python
python字典嵌套字典的情况下找到某个key的value详解
2019/07/10 Python
英国现代绅士品牌:Hackett
2017/12/17 全球购物
来自全球大都市的高级街头服饰:Pegador
2018/01/03 全球购物
捷克领先的户外服装及配件市场零售商:ALPINE PRO
2018/01/09 全球购物
Groupon比利时官方网站:特卖和网上购物高达-70%
2019/08/09 全球购物
园林设计师自荐信
2013/11/18 职场文书
军人违纪检讨书
2014/02/04 职场文书
小学中秋节活动方案
2014/02/06 职场文书
艺术学院毕业生自荐信
2014/07/05 职场文书
干部作风建设个人剖析材料
2014/10/11 职场文书
2015年暑假生活总结
2015/07/13 职场文书
暑期社会实践新闻稿
2015/07/17 职场文书
2016年党员岗位承诺书
2016/03/24 职场文书
mysql聚集索引、辅助索引、覆盖索引、联合索引的使用
2022/02/12 MySQL
JavaScript实现外溢动态爱心的效果的示例代码
2022/03/21 Javascript