If the httpd command uses the-f option, you can directly obtain the configuration file directory. If the httpd command does not use the-f option, for example, Step 1: Find the apache startup command:
ps -ef|grep httpdroot 10575 1 0 19:45 ? 00:00:03 /usr/sbin/httpd -k startmyuser 15356 2982 0 Jan19 ? 00:00:00 /home/apache/bin/httpd -f /home/apache/conf/httpd.conf -k start
If the httpd command uses the-f option, you can directly obtain the configuration file directory.
If the httpd command does not use the-f option, for example:
ps -ef|grep httpdroot 10575 1 0 19:45 ? 00:00:03 /usr/sbin/httpd -k startapache 10577 10575 0 19:45 ? 00:00:00 /usr/sbin/httpd -k startapache 10583 10575 0 19:45 ? 00:00:00 /usr/sbin/httpd -k startapache 10584 10575 0 19:45 ? 00:00:00 /usr/sbin/httpd -k startapache 10587 10575 0 19:45 ? 00:00:00 /usr/sbin/httpd -k startapache 10590 10575 0 19:45 ? 00:00:00 /usr/sbin/httpd -k startapache 10591 10575 0 19:45 ? 00:00:00 /usr/sbin/httpd -k start
Perform step 2.
Step 2: run the httpd-S command to find the path of the configuration file.
/usr/sbin/httpd -SVirtualHost configuration:211.157.8.76:80 is a NameVirtualHostdefault 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.