Apache: Very quick and Extremely dirty

From GluCki

Jump to: navigation, search

Okey, I thought we might as well have a quick and dirty series. So this time it's apache. This is so easy, my dog can do it.

Ubuntu users, open up synaptic and install apache (there's apache2 also, but I'm really not sure if it uses the same config file. Anyways, I got apache, so if you want to follow, you do it too), or install it from source. There are rpms also available all over the place. So whatever... lets just assume you got apache now. There's this file called httpd.conf. Mine is in the /etc/apache directory. Open it up in your favouite text editor (as root), and see if there is already a sample config file. It will usually be there. You dont need too many changes. I have attached my conf file, just in case ;) (httpd.conf). Just go to the line containing:


DocumentRoot /var/www/html (or /var/www sometimes)


Either put your website in this directory (preferable) or change it to the directory containing your index.html (the first file that opens when someone opens your website) All other files should be within this directory. You can also have symlinks pointing to various files/directories that are not in the DocumentRoot.

Next go to this line:


(AngleBracksOpen)Directory /var/www/html(AngleBracksClose) (or again /var/www)


and change it to what you set for DocumentRoot.

For each symlink, assign a similiar directory block (from (AngleBracksOpen)Directory ...(AngleBracksClose) to (AngleBracksOpen)/Directory(AngleBracksClose)). Simply copying the settings defined for your DocumentRoot is fine. You are now good to go!

Ubuntu users:


sudo /etc/init.d/apache start


Make sure apache starts each boot by navigating to System->Administration->Services and checking on the apache option

Fedora/RHEL people can type (as root ofcourse):


service httpd start chkconfig httpd on


Enjoy!