Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

which one of these 2 files should i use to configure apache?

the httpd.conf is empty while apache2.conf is not.

it confuses me!

share|improve this question

migrated from stackoverflow.com Sep 22 '12 at 16:56

This question came from our site for professional and enthusiast programmers.

add comment

4 Answers 4

up vote 34 down vote accepted

The httpd.conf is designed for user configurations. You really should not edit the apache2.conf as it may be updated by future upgrades.

An additional option is to just put your custom configuration into /etc/apache2/conf.d, all files in this directory are included as well.

share|improve this answer
2  
I don't have a file called apapche2.conf –  Doug Molineux Sep 9 '11 at 16:05
add comment

These are not your only options. On Ubuntu/Debian, Apache also processes all the files in /etc/apache2/sites-enabled/ (which should be symlinks to files in sites-available/ directory, managed by the a2ensite and a2dissite programs)

You're intended to use these directories for VirtualHosts.

share|improve this answer
    
this is the correct answer ! and also the ports/mods-available config files if you want to elaborate on your answer –  Sudhi Nov 19 '11 at 21:01
add comment

apache2.conf includes httpd.conf:

a@test$:/etc/apache2$ cat apache2.conf | grep httpd.conf 
Include /etc/apache2/httpd.conf

I think that httpd.conf is deprecated, but just left in there for conservative people so that they find they way around... :)

EDIT:

After reading Rob's answer, I did a better grep:

a@test:/etc/apache2$ grep -C 1 httpd.conf apache2.conf 
# Include all the user configurations:
Include /etc/apache2/httpd.conf

User configurations it is...

share|improve this answer
2  
+1 "httpd.conf is deprecated" –  feeela Jul 27 '12 at 12:05
add comment

If apache2.conf is not empty, and httpd.conf is empty, you should probably use apache2.conf ;-)

But I suppose that one includes the other (and that one of those is kept purely for backward compatibility reasons) -- so, it shouldn't change much.


Still, if you want to add something, like a new VirtualHost : is there not another sub-directory, in which you could put your file, and have it included ?

It would probably be a better solution : you would not modify the default file -- which would simplify updates.

share|improve this answer
    
As mentionned by Pascal, if you want to add a new VirtualHost, you should add a new file under sites-available and then have it symlink in sites-enabled with the command a2ensite - help.ubuntu.com/6.06/ubuntu/serverguide/C/httpd.html –  ccheneson Apr 2 '10 at 15:38
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.