Home  >  Article  >  Backend Development  >  How to check which httpd.conf is used by apache in linux

How to check which httpd.conf is used by apache in linux

伊谢尔伦
伊谢尔伦Original
2016-11-25 15:48:051317browse

Step one: Find the apache startup command:

ps -ef|grep httpd
root     10575   1  0 19:45 ?    00:00:03 /usr/sbin/httpd -k start
myuser   15356   2982   0   Jan19   ?   00:00:00   /home/apache/bin/httpd -f /home/apache/conf/httpd.conf -k start

If you see that the httpd command uses the -f option, you can directly get the configuration file directory.

If the httpd command does not use the -f option, such as:

ps -ef|grep httpd
root     10575     1  0 19:45 ?        00:00:03 /usr/sbin/httpd -k start
apache   10577 10575  0 19:45 ?        00:00:00 /usr/sbin/httpd -k start
apache   10583 10575  0 19:45 ?        00:00:00 /usr/sbin/httpd -k start
apache   10584 10575  0 19:45 ?        00:00:00 /usr/sbin/httpd -k start
apache   10587 10575  0 19:45 ?        00:00:00 /usr/sbin/httpd -k start
apache   10590 10575  0 19:45 ?        00:00:00 /usr/sbin/httpd -k start
apache   10591 10575  0 19:45 ?        00:00:00 /usr/sbin/httpd -k start

, perform the second step.

Step 2: Execute the httpd -S command to find out the configuration file path

/usr/sbin/httpd -S
VirtualHost configuration:
211.157.8.76:80        is a NameVirtualHost
default server wap.wapwu.com (/etc/httpd/conf/httpd.conf:1041)
port 80 namevhost wap.wapwu.com (/etc/httpd/conf/httpd.conf:1041)
port 80 namevhost wapu.wapwu.com (/etc/httpd/conf/httpd.conf:1052)
wildcard NameVirtualHosts and _default_ servers:
_default_:443          211.157.8.76 (/etc/httpd/conf.d/ssl.conf:88)
Syntax OK

From the log information output by apache, you can see that the configuration file is in the /etc/httpd/conf/ directory.


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn