Where to Start with Apache2?

Discussion in 'Server Operation' started by Vorlon, Oct 19, 2005.

  1. Vorlon

    Vorlon New Member

    I've been a long time user of Apache, even to the point of hosting virtual domains on my public web server, but I am at a loss how to configure apache2 that loaded with my Debian 3.1 Sarge setup.

    All the "tutorials" I've found are beyond me. Can somebody point me to a good beginner tutorial for Apache2?

    Alternately, can someone tell me where the heck is the default home page is stored???

    Thanks!
     
  2. falko

    falko Super Moderator ISPConfig Developer

    It's in /var/www.
     
  3. themachine

    themachine ISPConfig Developer ISPConfig Developer

    Yes, as falko mentioned, usually this is what you'll have for a default setup:

    /var/www/apache2-default => default web docs dir

    /etc/apache2 => apache config files

    /etc/apache2/apache2.conf => main apache configurations

    /etc/apache2/sites-available => Contains your virtual hosts, which are not enabled by default. 'default' is usually there. I generally copy this file to another file for each vhost, and then edit it (be sure to remove the 'NameVirtualHost = w.x.y.z' from the vhost files (you only want it once in the default config file). The default vhost file generally has all the basic information you need in order to copy, and setup seperate vhosts.

    /etc/apache2/sites-enabled => You create symlinks here, to the files in /etc/apache2/sites-available. Usually, you will see that '000-default' is the symlink back to '/etc/apache2/sites-available/default'. If you don't have the link here, apache doesn't read it. For example, if your vhost file is '/etc/apache2/sites-available/web1.example.com' then you need to execute the following command:

    Code:
    # ln -s /etc/apache2/sites-available/web1.example.com /etc/apache2/sites-enabled/web1.example.com
    
    /etc/apache2/mods-available => This is the home for your apache2 modules (hint: do a search like so 'apt-cache search libapache2-mod').

    /etc/apache2/mods-enabled => This directory again holds symlinks to the actually mods in /etc/apache2/mods-available. Apache will *not* load any mods that are not symlinked in this dir.

    If you want mod-php4 enabled, you need to first install it, and then enable it:

    Code:
    # apt-get install libapache2-mod-php4
    
    # ln -s /etc/apache2/mods-available/php4.load /etc/apache2/mods-enabled/php4.load
    
    # ln -s /etc/apache2/mods-available/php4.conf /etc/apache2/mods-enabled/php4.conf
    ---

    Note: There is a 'Redirect' directive in your default apache2 vhost file which sends the request to '/apache2-default'. Therefore if you edit the default file instead of creating a different vhost file, you will need to remove this directive.

    Ideally, you would probably want to set up your vhost web docs dir like '/var/www/web1', '/var/www/web2'.

    Personally, I lay mine out like so:

    /var/www

    ===> /var/www/web1
    ======> /var/www/web1/cgi-bin
    ======> /var/www/web1/htdocs
    ======> /var/www/web1/logs

    ===> /var/www/web2
    ...

    I find it keeps everything organized nicely... If you have any further question, please let me know... perhaps I could write up a basic beginner how to tonight.

    [dierkes.themachine]
     
    Last edited: Nov 22, 2005

Share This Page