LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (http://www.linuxquestions.org/questions/linux-server-73/)
-   -   apache2 - which conf file to use ? (http://www.linuxquestions.org/questions/linux-server-73/apache2-which-conf-file-to-use-626588/)

uncle-c 03-08-2008 08:54 AM

apache2 - which conf file to use ?
 
Hello,
I'm using Ubuntu 7.04 server which comes with apache2. I done some directory surfring and found that there are two .conf files : apache2.conf and httpd.conf. I want to add the directives ServerName and DocumentRoot but into which of the conf files should I place the two directives ???

Thanks !

UC

reddazz 03-08-2008 09:07 AM

Most likely you want httpd.conf (thats the standard on most Linux distros and the BSDs).

uncle-c 03-08-2008 09:21 AM

Thanks reddazz. The httpd.conf file is empty ( 0Kb) whereas the apache2.conf ( 21Kb) contains all the other directives which are usually associated with the httpd.conf file, hence, the confusion.

reddazz 03-08-2008 09:30 AM

It could be one of those things that Ubuntu has decided to do differently. Is httpd.conf a symlink to apache2.conf? Try making your changes in apache2.conf and see if they work.

uncle-c 03-08-2008 09:42 AM

They are not symlinked but I can put the directive ServerName in either of the two files and everything seems to work ok. I'm just intrigued and curious.

Edit: Just been doing a bit of reading around. Apparently in Ubuntu/ Debian the httpd.conf file is now redundant and apache2.conf is where all the action is.

reddazz 03-08-2008 11:07 AM

Quote:

Edit: Just been doing a bit of reading around. Apparently in Ubuntu/ Debian the httpd.conf file is now redundant and apache2.conf is where all the action is.
This is one of those things that annoys me about some Linux distros. Everyone else has standardised on httpd.conf and they move away from that.

the_guv 07-23-2009 03:48 PM

there's a cascade of importance ..

anything you add to the httpd.conf overides apache2.conf. and anything in your vhost files takes precedence over both.

sokha 07-23-2009 10:36 PM

I think for ubuntu and debian, they use apache2.conf. And httpd.conf is in centos.

the_guv 07-24-2009 04:29 AM

Quote:

Originally Posted by sokha (Post 3618332)
I think for ubuntu and debian, they use apache2.conf. And httpd.conf is in centos.

Well, for Ubuntu and Debian - at least when installed with LAMP via tasksel - there is ah httpd.conf, but it's blank on install, and I guess used for supplementary commands.

Sure, you could ignore it and just use the apache2.conf, or vhost files.

Jinojosep 05-04-2012 10:03 AM

The below command will list the compile settings for apache

# apache2 -V | grep conf
-D SERVER_CONFIG_FILE="/etc/apache2/apache2.conf"

Here we can see that the /etc/apache2/apache2.conf is the configuration file.

unistinger 07-15-2012 12:04 PM

Hello everyone!
First of all excuse my English!
I just came by while searching for an answer for the same question!
And based on your argue guys, I did this small test just to see what file does apache depend on when it starts. I simply renamed httpd.conf to something else (e.g. http.conf_) and restarted apache. And the result? Apache failed to start!

Then did the same thing to the other file (apache2.conf), and again apache failed to start, which means that apache will actually read and apply any configs done in BOTH FILES!

And thanks for reading!!

P.S. did the test under Debian 5...

money_shots 01-09-2013 08:57 PM

# Include all the user configurations:
Include httpd.conf


This is now added in apache2.conf, dont know when it was added though.


All times are GMT -5. The time now is 04:33 AM.