查看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 相关文章推荐
Apache站点配置SSL强制跳转443
Mar 09 Servers
nginx location中多个if里面proxy_pass的方法
Mar 31 Servers
学习nginx基础知识
Sep 04 Servers
详解Nginx 被动检查服务器的存活状态
Oct 16 Servers
Mac电脑OS系统下安装Nginx的详细教程
Apr 14 Servers
Windows Server 2019 域控制器安装图文教程
Apr 28 Servers
解决IIS7下无法绑定https主机的问题
Apr 29 Servers
zabbix配置nginx监控的实现
May 25 Servers
Nginx 配置 HTTPS的详细过程
May 30 Servers
服务器SVN搭建图文安装过程
Jun 21 Servers
Windows server 2016服务器基本设置
Aug 14 Servers
ubuntu开机后ROS程序自启动问题
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中$GLOBALS['HTTP_RAW_POST_DATA']和$_POST的区别分析
2017/07/03 PHP
PHP如何防止XSS攻击与XSS攻击原理的讲解
2019/03/22 PHP
PHP实现的AES 128位加密算法示例
2019/09/16 PHP
Ext javascript建立超链接,进行事件处理的实现方法
2009/03/22 Javascript
jquery animate 动画效果使用说明
2009/11/04 Javascript
关于jquery动态增减控件的一些想法和小插件
2010/08/01 Javascript
jquery数据验证插件(自制,简单,练手)实例代码
2013/10/24 Javascript
javascript实现根据身份证号读取相关信息
2014/12/17 Javascript
JavaScript中5种调用函数的方法
2015/03/12 Javascript
Javascript实现苹果悬浮虚拟按钮
2016/04/10 Javascript
jQuery使用deferreds串行多个ajax请求
2016/08/22 Javascript
微信小程序ajax实现请求服务器数据及模版遍历数据功能示例
2017/12/15 Javascript
详解Vue2 添加对scss的支持
2019/01/02 Javascript
浅谈webpack devtool里的7种SourceMap模式
2019/01/14 Javascript
vue鼠标悬停事件实例详解
2019/04/01 Javascript
jQuery事件绑定和解绑、事件冒泡与阻止事件冒泡及弹出应用示例
2019/05/13 jQuery
vue  elementUI 表单嵌套验证的实例代码
2019/11/06 Javascript
基于js实现逐步显示文字输出代码实例
2020/04/02 Javascript
JavaScript实现轮播图效果
2020/10/30 Javascript
浅析Python中的赋值和深浅拷贝
2017/08/15 Python
[原创]Python入门教程2. 字符串基本操作【运算、格式化输出、常用函数】
2018/10/29 Python
ubuntu 18.04搭建python环境(pycharm+anaconda)
2019/06/14 Python
Python数据处理篇之Sympy系列(五)---解方程
2019/10/12 Python
关于Theano和Tensorflow多GPU使用问题
2020/06/19 Python
Python 实现将某一列设置为str类型
2020/07/14 Python
scrapy与selenium结合爬取数据(爬取动态网站)的示例代码
2020/09/28 Python
Python使用eval函数执行动态标表达式过程详解
2020/10/17 Python
美国婴儿和儿童家具网上商店:ABaby.com
2018/07/02 全球购物
美国珠宝精品店:Opulent Jewelers
2019/08/20 全球购物
毕业自我鉴定
2013/11/05 职场文书
十八届三中全会报告学习材料
2014/02/17 职场文书
建筑工地大门标语
2014/06/18 职场文书
责任书格式范文
2014/07/28 职场文书
2014年科协工作总结
2014/12/09 职场文书
企业宣传稿范文
2015/07/23 职场文书
浅谈sql_@SelectProvider及使用注意说明
2021/08/04 Java/Android