Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lost httpd.conf file located apache [closed]

How can I find where my httpd.conf file is located?

I am running an Ubuntu Linux server from the Amazon Web Services EC2 (Elastic Compute Cloud) and I can't find my Apache config.

like image 684
Shalin Shah Avatar asked Aug 30 '12 17:08

Shalin Shah


People also ask

Where is httpd conf file located?

The Apache HTTP Server configuration file is /etc/httpd/conf/httpd.

Where is httpd located Linux?

The HTTP configuration files are located under the "/etc/httpd" directory, with the main configuration file being the "/etc/httpd/conf/httpd. conf" file. The default document root is "/var/www/html". Any files or directories below this point will be visible using a browser once you configure the firewall.

Is apache2 Conf the same as httpd conf?

conf: historically the main Apache2 configuration file, named after the httpd daemon. The file can be used for user specific configuration options that globally effect Apache2.


2 Answers

Get the path of running Apache

$ ps -ef | grep apache apache   12846 14590  0 Oct20 ?        00:00:00 /usr/sbin/apache2 

Append -V argument to the path

$ /usr/sbin/apache2 -V | grep SERVER_CONFIG_FILE -D SERVER_CONFIG_FILE="/etc/apache2/apache2.conf" 

Reference:
http://commanigy.com/blog/2011/6/8/finding-apache-configuration-file-httpd-conf-location

like image 135
squiguy Avatar answered Sep 20 '22 13:09

squiguy


See http://wiki.apache.org/httpd/DistrosDefaultLayout for discussion of where you might find Apache httpd configuration files on various platforms, since this can vary from release to release and platform to platform. The most common answer, however, is either /etc/apache/conf or /etc/httpd/conf

Generically, you can determine the answer by running the command:

httpd -V

(That's a capital V). Or, on systems where httpd is renamed, perhaps apache2ctl -V

This will return various details about how httpd is built and configured, including the default location of the main configuration file.

One of the lines of output should look like:

-D SERVER_CONFIG_FILE="conf/httpd.conf"

which, combined with the line:

-D HTTPD_ROOT="/etc/httpd"

will give you a full path to the default location of the configuration file

like image 29
Rich Bowen Avatar answered Sep 20 '22 13:09

Rich Bowen