查看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使用X-Accel-Redirect实现静态文件下载的统计、鉴权、防盗链、限速等
Apr 04 Servers
Nginx内网单机反向代理的实现
Nov 07 Servers
Nginx实现负载均衡的项目实践
Mar 18 Servers
CKAD认证中部署k8s并配置Calico插件
Mar 31 Servers
CentOS7安装GlusterFS集群以及相关配置
Apr 12 Servers
Docker官方工具docker-registry案例演示
Apr 13 Servers
Tomcat弱口令复现及利用
May 06 Servers
详解ZABBIX监控ESXI主机的问题
Jun 21 Servers
Nginx代理Redis哨兵主从配置的实现
Jul 15 Servers
Nginx如何获取自定义请求header头和URL参数详解
Jul 23 Servers
Apache SkyWalking 监控 MySQL Server 实战解析
Sep 23 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
PHP5.5.15+Apache2.4.10+MySQL5.6.20配置方法分享
2016/05/06 PHP
php报错502badgateway解决方法
2019/10/11 PHP
JavaScript DOM学习第四章 getElementByTagNames
2010/02/19 Javascript
js window.open弹出新的网页窗口
2014/01/16 Javascript
jQuery trigger()方法用法介绍
2015/01/13 Javascript
jQuery实现新消息闪烁标题提示的方法
2015/03/11 Javascript
easyui Draggable组件实现拖动效果
2015/08/19 Javascript
全系IE支持Bootstrap的解决方法
2015/10/19 Javascript
Bootstrap每天必学之按钮(Button)插件
2016/04/25 Javascript
新入门node.js必须要知道的概念(必看篇)
2016/08/10 Javascript
js正则表达式验证密码强度【推荐】
2017/03/03 Javascript
关于javascript获取内联样式与嵌入式样式的实例
2017/06/01 Javascript
vue.js中父组件调用子组件的内部方法示例
2017/10/22 Javascript
JS非行间样式获取函数的实例代码
2018/06/05 Javascript
深入理解react 组件类型及使用场景
2019/03/07 Javascript
JS学习笔记之原型链和利用原型实现继承详解
2019/05/29 Javascript
Vue动态创建注册component的实例代码
2019/06/14 Javascript
解决layui数据表格排序图标被超出的表头挤出去的问题
2019/09/19 Javascript
node 版本切换的实现
2020/02/02 Javascript
vue实现简单跑马灯效果
2020/05/25 Javascript
让python在hadoop上跑起来
2016/01/27 Python
AI人工智能 Python实现人机对话
2017/11/13 Python
Python实现判断给定列表是否有重复元素的方法
2018/04/11 Python
Python os.rename() 重命名目录和文件的示例
2018/10/25 Python
Python WEB应用部署的实现方法
2019/01/02 Python
对PyQt5中树结构的实现方法详解
2019/06/17 Python
jupyter notebook 调用环境中的Keras或者pytorch教程
2020/04/14 Python
One.com挪威:北欧成长最快的网络托管公司
2016/11/19 全球购物
皇家道尔顿官网:Royal Doulton
2017/12/06 全球购物
美国领先的商务贺卡出版商:The Gallery Collection
2018/02/13 全球购物
文秘专业毕业生就业推荐信
2013/11/08 职场文书
医学检验专业大学生求职信
2013/11/18 职场文书
物流管理专业求职信
2014/05/29 职场文书
支部书记四风问题自我剖析材料
2014/09/29 职场文书
《半截蜡烛》教学反思
2016/02/19 职场文书
2019消防宣传标语!
2019/07/10 职场文书