Skip to content

On configuring apache2 – useful notes

by Ammar on September 16, 2011

The apache2 webserver can be very daunting for someone who’s a new user. I just spent a good amount of time wading through the mess I made when I first set it up in understanding and fixing a couple of things to make it work. This is part a reference to myself, part a quick primer to anyone else struggling with apache. There’s not too much detail, but it’s a way to get you started.

Config file

Apache sources a configuration file which can be modified for specific uses. The default config file is httpd.conf, and on most linux machines, it is located at /etc/apache2/httpd.conf. To see which config file your apache2 server is using, type in the command apache2 -V and  one of the last lines of output will say something like SERVER_CONFIG_FILE and will tell you the location of the config file.

Modules

Apache2 supports a bunch of modules which are included by default, such as those for enabling proxies, and some that you have to install manually, such as mod-wsgi. Once you have the module, something to make sure you don’t trip up on is enabling the module using the command a2enmod (apache2 enable mod). Example: a2enmod mod-wsgi

htaccess files

Files named .htaccess have a special meaning in directories pointed to by apache. It is a file that contains directory specific configuration, such as whether to allow access to the directory or not. A lot of web frameworks, like wordpress  to have a certain configuration in the .htaccess file, and they usually give you the code you need to put in the line. To allow .htaccess files to be used, however, they have to be readable by the user of the apache2 server, and the apache config file has to have AllowOverride All to allow the local .htaccess files to override the server settings.

From → Tech

No comments yet

Leave a Reply

Note: HTML is allowed. Your email address will not be published.

Subscribe to this comment feed via RSS

Spam prevention powered by Akismet