查看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 URL重写rewrite机制原理及使用实例
Apr 01 Servers
nginx+lua单机上万并发的实现
May 31 Servers
详解nginx location指令
Jan 18 Servers
nginx共享内存的机制详解
Mar 21 Servers
Apache Hudi 加速传统的批处理模式
Apr 24 Servers
Ubuntu Server 安装Tomcat并配置systemctl
Apr 28 Servers
Nginx 安装SSL证书完成HTTPS部署
Apr 28 Servers
windows server2008 开启端口的实现方法
Jun 25 Servers
windows系统安装配置nginx环境
Jun 28 Servers
nginx访问报403错误的几种情况详解
Jul 23 Servers
windows server2012 R2下安装PaddleOCR服务的的详细步骤
Sep 23 Servers
ubuntu端向日葵键盘输入卡顿问题及解决
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函数microtime()用法与说明
2013/12/04 PHP
php+memcache实现的网站在线人数统计代码
2014/07/04 PHP
PHP Session机制简介及用法
2014/08/19 PHP
PHP+jquery+ajax实现即时聊天功能实例
2014/12/23 PHP
PHP IDE phpstorm 常用快捷键
2015/05/18 PHP
Laravel框架实现简单的学生信息管理平台案例
2019/05/07 PHP
Nigma vs Alliance BO5 第一场2.14
2021/03/10 DOTA
jQuery入门第一课 jQuery选择符
2010/03/14 Javascript
ExtJS的拖拽效果示例
2013/12/09 Javascript
基于jQuery滑动杆实现购买日期选择效果
2015/09/15 Javascript
Node.js的Express框架使用上手指南
2016/03/12 Javascript
AngularJS模块详解及示例代码
2016/08/17 Javascript
几句话带你理解JS中的this、闭包、原型链
2016/09/26 Javascript
jquery表单验证实例仿Toast提示效果
2017/03/03 Javascript
javascript编程实现栈的方法详解【经典数据结构】
2017/04/11 Javascript
node中Express 动态设置端口的方法
2017/08/04 Javascript
完美解决手机浏览器顶部下拉出现网页源或刷新的问题
2017/11/30 Javascript
vue组件的写法汇总
2018/04/12 Javascript
用node开发并发布一个cli工具的方法步骤
2019/01/03 Javascript
vue 实现cli3.0中使用proxy进行代理转发
2019/10/30 Javascript
openlayers实现图标拖动获取坐标
2020/09/25 Javascript
学习python (2)
2006/10/31 Python
Python ORM框架SQLAlchemy学习笔记之数据添加和事务回滚介绍
2014/06/10 Python
python开发中module模块用法实例分析
2015/11/12 Python
利用python获取Ping结果示例代码
2017/07/06 Python
python编写Logistic逻辑回归
2020/12/30 Python
python requests抓取one推送文字和图片代码实例
2019/11/04 Python
Herschel Supply Co.美国:背包、手提袋及配件
2020/11/24 全球购物
美国小蜜蜂Burt’s Bees德国官网:天然唇部、皮肤和身体护理产品
2020/06/14 全球购物
巴西购物网站:Onofre Agora
2020/06/08 全球购物
法学专业应届生求职信
2013/10/16 职场文书
医院院务公开实施方案
2014/05/03 职场文书
防汛工作情况汇报
2014/10/28 职场文书
毕业典礼邀请函
2015/01/31 职场文书
初中生入团申请书范文(五篇)
2019/10/16 职场文书
用React Native制作一个简单的游戏引擎
2021/05/27 Javascript