查看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+Tomcat实现负载均衡、动静分离的原理解析
Mar 31 Servers
利用Nginx代理如何解决前端跨域问题详析
Apr 02 Servers
Apache Pulsar集群搭建部署详细过程
Feb 12 Servers
Nginx实现会话保持的两种方式
Mar 18 Servers
Mac电脑OS系统下安装Nginx的详细教程
Apr 14 Servers
阿里云 Windows server 2019 配置FTP
Apr 28 Servers
nginx配置限速限流基于内置模块
May 02 Servers
永中文档在线转换预览基于nginx配置部署方案
Jun 10 Servers
详解ZABBIX监控ESXI主机的问题
Jun 21 Servers
win sever 2022如何占用操作主机角色
Jun 25 Servers
nginx之内存池的实现
Jun 28 Servers
解决ubuntu安装软件时,status-code=409报错的问题
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
通过ICQ网关发送手机短信的PHP源程序
2006/10/09 PHP
写一个用户在线显示的程序
2006/10/09 PHP
php生成随机密码自定义函数代码(简单快速)
2014/05/10 PHP
PHP会话控制:Session与Cookie详解
2014/09/27 PHP
ThinkPHP控制器详解
2015/07/27 PHP
PHP模拟QQ登录的方法
2015/07/29 PHP
JQuery 学习笔记 选择器之六
2009/07/23 Javascript
Javascript base64编码实现代码
2011/12/02 Javascript
JS连接SQL数据库与ACCESS数据库的方法实例
2013/11/21 Javascript
node.js中的fs.fchmodSync方法使用说明
2014/12/16 Javascript
node.js开机自启动脚本文件
2014/12/24 Javascript
JS拖拽插件实现步骤
2015/08/03 Javascript
js选择器全面解析
2016/06/27 Javascript
javascript实现Emrips反质数枚举的示例代码
2017/12/06 Javascript
Vue实现input宽度随文字长度自适应操作
2020/07/29 Javascript
小程序实现上传视频功能
2020/08/18 Javascript
JavaScript TAB栏切换效果的示例
2020/11/05 Javascript
基于Vue+Webpack拆分路由文件实现管理
2020/11/16 Javascript
[49:08]完美世界DOTA2联赛PWL S2 LBZS vs FTD.C 第一场 11.27
2020/12/01 DOTA
python计算圆周长、面积、球体体积并画出圆
2014/04/08 Python
Python的加密模块md5、sha、crypt使用实例
2014/09/28 Python
Python实现小数转化为百分数的格式化输出方法示例
2017/09/20 Python
python opencv设置摄像头分辨率以及各个参数的方法
2018/04/02 Python
pandas 使用均值填充缺失值列的小技巧分享
2019/07/04 Python
Python字符串和正则表达式中的反斜杠('\')问题详解
2019/09/03 Python
python+OpenCV实现车牌号码识别
2019/11/08 Python
Python 爬虫的原理
2020/07/30 Python
美国最大的船只买卖在线市场:Boat Trader
2018/08/04 全球购物
如何用SQL语句进行模糊查找
2015/09/25 面试题
文秘专业大学生求职信
2013/11/10 职场文书
机关党员2014全国两会学习心得体会
2014/03/10 职场文书
买卖车协议书
2014/04/21 职场文书
敬老模范事迹
2014/05/21 职场文书
公务员试用期满考核材料
2014/05/22 职场文书
OpenCV-Python实现怀旧滤镜与连环画滤镜
2021/06/09 Python
FP-growth算法发现频繁项集——发现频繁项集
2021/06/24 Python