Apache2 linux httpd conf

Where does Apache install httpd.conf by default?

What you did «wrong» was to not read the documentation, which clearly states:

PREFIX must be replaced with the filesystem path under which the server should be installed. If PREFIX is not specified, it defaults to /usr/local/apache2.

However, I put «wrong» in quotes because I cannot find anything wrong with those directories. What’s so bad about /usr/local ?

Thanks innaM. I did read (and re-read) the documentation, but didn’t realize this applied to httpd.conf. After a 3rd read, it does seem pretty clear. What is bad about /usr/local ? In the past, I always saw it located at /etc/httpd/conf/httpd.conf . Where is the most common or proper location?

Manually installed software should usually not pollute system directories. Apache is well behaved in this respect. Install Apache why your distributions package management system and the paths should look more familiar.

There will be no problem with httpd.conf in /usr/local. The only problem will be that others will not be expecting it there so they might become confused. Rest is okay. While compiling you should have mentioned /etc/httpd/conf/httpd.conf, but I will say still its not a problem.

Do you had any particular reason for compiling Apache and not using yum. If you have used yum, the file would have automatically landed in /etc/httpd/conf/httpd.conf.

Why install from source? Because this is how I interpreted that the documentation wanted me to do so. Is this not correct? Thanks httpd.apache.org/docs/2.2/install.html

The option of compilation is always there, but that does not mean that you have to use it every time. You mentioned CentOS 6.4, I always install apache from yum on CentOS even on critical production servers. And I never face a problem. Of course, sometimes compilation is the only option, like one time I have to install apache on a cPanel Server, and no other option was available for latest version.

Читайте также:  Shell linux read file line by line

Источник

Ubuntu Apache: httpd.conf or apache2.conf?

which one of these two files should I use to configure Apache? The httpd.conf is empty, while apache2.conf is not. It confuses me!

8 Answers 8

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.

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 VirtualHost s.

this is the correct answer ! and also the ports/mods-available config files if you want to elaborate on your answer

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. 🙂

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.

The Apache Software Foundation publishes many bits of software, one of which is a web server named httpd . The httpd project sources include among other things an httpd.conf sample configuration file, which is installed by default in /usr/local/etc/httpd or /etc/httpd . You will find httpd named as such on most systems.

However, long ago and far away, someone in the Debian GNU/Linux distribution decided to change the name of the software within that distribution from httpd to apache2 . Thus on a Debian system you will find a configuration file named apache2.conf in a directory named /etc/apache2 . I don’t know who did this or why, but it’s a perennial source of confusion on par with calling Windows «Microsoft» or ESXi «VMware». Distributions based on Debian, such as Ubuntu, inherit this strangeness. Even stranger, they then include a file /etc/apache2/httpd.conf which is Include d from apache2.conf into which users can place custom configuration.

Читайте также:  Средства восстановления данных linux

So the answer is, if you’re on a Debian-based system, you bend your brain into doing things the way Debian wants you to do it. Otherwise you generally do things the normal way as the upstream httpd project does it.

Apache 2.4 (under Debian/Ubuntu)

For Configuration/Overrides (not necessarily a new site):

Place a new configuration file in /etc/apache2/conf-available/.conf .

Enable/Disable your new config using sudo a2enconf or sudo a2disconf .

Directives in these can also override httpd.conf or apache2.conf as any additional config files added by user are read in last after main config.

Restart apache2 service to reflect the change.

For Sites (and any site specific configuration overrides):

Place a new site file in /etc/apache2/sites-available/.conf

Enable/Disable your site config using sudo a2ensite or sudo a2dissite .

Restart apache2 service to reflect the change.

httpd.conf is still installed as main config file on some Linux distributions. On others, you should NOT see it anymore — if you do, leave it empty as installed if you wish to upgrade Apache cleanly/easily via package manager.

apache2.conf is still installed on many systems and is used as the main configuration file for Debian/Ubuntu. But, leave it alone if you wish to upgrade Apache cleanly/easily. You should see some include statements near the bottom of this file for sites and custom configurations.
Use them instead!

One, or both of these files may be installed via your Linux package manager depending on the Linux distribution. This is a good reason NOT to touch them since they could accidentally be overwritten during a system upgrade in the future.

Читайте также:  Команда включить wifi linux

Anything you might see in «global» Apache2 configuration files can be added/overridden under your custom config as per above. You can also use include statements yourself to further customize. Example: You could include additional SSL directives you want on some/all sites from a specific custom include file. You would just add this include statement to all your virtual site configs as needed.

Источник

Httpd.conf – What’s its Location on Ubuntu?

Here’s where to find the Apache 2 web server configuration file httpd.conf on Ubuntu.

Did you know that on Ubuntu, the main Apache configuration file is not httpd.conf ? The main Apache config file is actually apache2.conf .

When Apache 2 reads apache2.conf , the contents of httpd.conf is included by an include directive in apache2.conf . Here’s the lines from apache2.conf that include httpd.conf :

# Include all the user configurations: Include /etc/apache2/httpd.conf

So use httpd.conf on Ubuntu is specifically for your servers specific configuration. You may still need to want to edit apache2.conf at times, to change Apache’s configuration rather than add to it.

Httpd.conf Location

On Ubuntu, httpd.conf is located in the directory /etc/apache2 . apache2.conf is also located in /etc/apache2 .

Httpd.conf Location for Specific Ubuntu Versions

To ensure these locations are accurate, I’ve checked httpd.conf’s location on a number of different Ubuntu versions. The definitive article is Where is Httpd.conf’s Location on Ubuntu? at Ubuntu Gods.

Ubuntu Version httpd.conf Location
Ubuntu 7.04 Feisty Fawn /etc/apache2/httpd.conf
Ubuntu 8.10 Intrepid Ibex /etc/apache2/httpd.conf
Ubuntu 10.10 Maverick Meerkat /etc/apache2/httpd.conf

Additions & refinements welcome!

Источник

Оцените статью
Adblock
detector