Results 1 to 5 of 5

Thread: apache - virtual hosts

  1. #1
    Join Date
    Apr 2008
    Beans
    8

    apache - virtual hosts

    Hello all,

    I have set up apache on ubuntu server edition. I have everything running but I am having a very hard time setting up virtual hosting. I am using ssh to get into the server and change all the configuration files.

    First, in /etc/apache2/sites-available, I have my own (new) file that i called example.exampledomain.com.conf

    That file looks like this:

    <VirtualHost example.exampledomain.com>
    ServerAdmin example@example.com
    #We want to be able to access the web site using www.dev.example.com or dev.example.com
    ServerAlias www.example.exampledomain.com
    DocumentRoot /home/myusername/public_html/example.exampledomain.com
    #if using awstats
    ScriptAlias /awstats/ /usr/lib/cgi-bin/
    #we want specific log file for this server
    CustomLog /var/log/apache2/example.com-access.log combined
    </VirtualHost>

    I have tried everything but still no luck. I have also tried the a2ensite but it says that site is already enabled. When I browse to my site, I get the normal, it works message instead of the index.html file I placed in my document root.

    What am I doing wrong?

    Thanks,

    jk111

    P.S. I also have a link to example.exampledomain.com.conf in /etc/apache2/sites-enabled

  2. #2
    Join Date
    Apr 2008
    Beans
    2

    Re: apache - virtual hosts

    Code:
    <VirtualHost *:80>
        ServerAdmin example@example.com
        DocumentRoot /home/myusername/public_html/example.exampledomain.com
        ServerName server.example.com
        ServerAlias dev.example.com www.dev.example.com
        ScriptAlias /awstats/ /usr/lib/cgi-bin/
        CustomLog /var/log/apache2/example.com-access.log combined
    </VirtualHost>
    then
    Code:
    /etc/init.d/apache2 restart
    if you have any problems check the log.

  3. #3
    Join Date
    Apr 2008
    Beans
    8

    error

    I get the message: _default_ virtualhost overlap on port 80, the first has precedence.

    When i browse to both of my sites, the same index.html file is shown although they do differ in the document root.

    What did I do wrong?

    Thanks

  4. #4
    Join Date
    Feb 2007
    Location
    Perth, WA, Aust
    Beans
    44
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: error

    Hi,

    I found this works on my Ubuntu PC:
    I copied the Default from the sites-available directory,
    removed the NameVirtualHost,
    added the Servername (and ServerAlias, in your case),
    changed DocumentRoot
    and restarted apache2.

    Works like a charm for me.
    Juts thought I'd share.
    Regards,

    Jason Brisbane

  5. #5
    Join Date
    Apr 2008
    Beans
    8

    Re: apache - virtual hosts

    Although I do not get any errors, both my domains open to the same index file even though they differ and their document roots are different.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •