如何正确找到nginx的配置文件位置


一.先找到nginx可执行文件的路径

  a。程序正在运行中:

# ps -ef | grep nginx

root 771 1 0 10:36 ? 00:00:00 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;  # 看到mster进程,可以直接看到可执行文件路径
www-data 772 771 0 10:36 ? 00:00:00 nginx: worker process
www-data 773 771 0 10:36 ? 00:00:00 nginx: worker process
root 3282 3233 0 15:58 pts/3 00:00:00 grep --color=auto nginx  # 忽略这个查询进程

  b.程序没有运行:

# whereis nginx   // 查看软件安装路径

nginx: /usr/sbin/nginx /etc/nginx /usr/share/nginx
# which nginx // 查询运行文件所在路径

/usr/sbin/nginx

   c .其他查询方法

rpm包安装的,可以用rpm -qa | grep “软件或者包的名字”查询;
#
rpm -qa | grep nginx
yum方法安装的,可以用yum list installed查找;
#
yum list installed

 

二.在通过nginx自身的功能找到当前nginx对应的配置文件路径

#/usr/sbin/nginx -t   # conf_path

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok  # 检测nginx.conf配置文件语法正确
nginx: configuration file /etc/nginx/nginx.conf test is successful  # 测试nginx.conf配置文件执行正确

 

三》在/etc/nginx/nginx.conf 配置文件中设置nginx配置

四:查看MySQL的配置文件路径

首先先看看你的mysql在哪,通过which命令which mysql
显示出目录比如我的是这个 /usr/bin/mysql
接下来就可以针对这个目录通过一些命令查看配置文件在哪了,如下
/usr/bin/mysql --verbose --help | grep -A 1 'Default options'
然后在下面会出现一些信息
Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf /usr/etc/my.cnf ~/.my.cnf
这个信息的意思是:
服务器首先读取的是/etc/mysql/my.cnf文件,如果前一个文件不存在则继续读/etc/my.cnf文件,如若还不存在便会去读~/.my.cnf文件

原文链接:https://blog.csdn.net/OMars/article/details/88086838

/usr/bin/mysql --verbose --help | grep -A 1 'Default options'


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM