Need help with Apache virtual servers

This is a discussion on Need help with Apache virtual servers within the Tech Board forums, part of the Community Boards category; Hello, I've been struggling with this for weeks and haven't been able to get it working. Here's how it works: ...

  1. #1
    User
    Join Date
    Jan 2006
    Location
    Canada
    Posts
    498

    Need help with Apache virtual servers

    Hello, I've been struggling with this for weeks and haven't been able to get it working. Here's how it works:

    I have a friend who has a Ubuntu webserver running at http://brutongarden.org. Due to the instability of my website RightOnThruHere running on Dhost, I decided I'd try to move my site over to brutongarden. It's up to me to setup the virtual hosts.

    Here's what I've placed in /etc/apache2/sites-enabled/default:
    Code:
    <VirtualHost righton.ath.cx:80>
            ServerAdmin blah@blah.nothing
    
            ServerName righton.ath.cx
            ServerAlias righton.ath.cx *.righton.ath.cx rightonthruhere.ath.cx *.rightonthruhere.ath.cx
            DocumentRoot /var/www/righton/
            <Directory />
                    Options FollowSymLinks
                    AllowOverride None
            </Directory>
            <Directory /var/www/righton>
                    Options Indexes FollowSymLinks MultiViews
                    AllowOverride None
                    Order allow,deny
                    allow from all
                    # This directive allows us to have apache2's default start page
                    # in /apache2-default/, but still have / go to the right place
                    # Commented out for Ubuntu
                    #RedirectMatch ^/$ /apache2-default/
            </Directory>
    
            ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
            <Directory "/usr/lib/cgi-bin">
                    AllowOverride None
                    Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
                    Order allow,deny
                    Allow from all
            </Directory>
    
            ErrorLog /var/log/apache2/error.log
    
            # Possible values include: debug, info, notice, warn, error, crit,
    
            # alert, emerg.
           <Directory /var/www/righton>
                    Options Indexes FollowSymLinks MultiViews
                    AllowOverride None
                    Order allow,deny
                    allow from all
                    # This directive allows us to have apache2's default start page
                    # in /apache2-default/, but still have / go to the right place
                    # Commented out for Ubuntu
                    #RedirectMatch ^/$ /apache2-default/
            </Directory>
    
            ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
            <Directory "/usr/lib/cgi-bin">
                    AllowOverride None
                    Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
                    Order allow,deny
                    Allow from all
            </Directory>
    
            ErrorLog /var/log/apache2/error.log
    
            # Possible values include: debug, info, notice, warn, error, crit,
            # alert, emerg.
            LogLevel warn
    
            CustomLog /var/log/apache2/access.log combined
            ServerSignature Off
    
        Alias /doc/ "/usr/share/doc/"
        <Directory "/usr/share/doc/">
            Options Indexes MultiViews FollowSymLinks
            AllowOverride None
            Order deny,allow
            Deny from all
            Allow from 127.0.0.0/255.0.0.0 ::1/128
        </Directory>
    
    </VirtualHost>
    The same entry is also present in /etc/apache2/sites-available/default. In httpd.conf, I have the following entry:
    Code:
    <VirtualHost *:80>
    ServerName righton.ath.cx
    ServerAlias righton.ath.cx *.righton.ath.cx rightonthruhere.ath.cx
    DocumentRoot /var/www/righton/
    </VirtualHost>
    But no matter how many times the webserver is rebooted,
    http://righton.ath.cx
    always goes to http://brutongarden.org, instead of my mirrored Right On Thru Here.

    Is there something I've done wrong, or another file that still needs editing?

  2. #2
    Registered User Jaqui's Avatar
    Join Date
    Feb 2005
    Posts
    416
    According to the default apache config file [ apache 2 ]:
    Code:
    ### Section 3: Virtual Hosts
    #
    # VirtualHost: If you want to maintain multiple domains/hostnames on your
    # machine you can setup VirtualHost containers for them. Most configurations
    # use only name-based virtual hosts so the server doesn't need to worry about
    # IP addresses. This is indicated by the asterisks in the directives below.
    #
    # Please see the documentation at 
    # <URL:http://httpd.apache.org/docs-2.0/vhosts/>
    # for further details before you try to setup virtual hosts.
    #
    # You may use the command line option '-S' to verify your virtual host
    # configuration.
    
    #
    # Use name-based virtual hosting.
    #
    #NameVirtualHost *:80
    #Setenv VLOG 
    
    #
    # VirtualHost example:
    # Almost any Apache directive may go into a VirtualHost container.
    # The first VirtualHost section is used for requests without a known
    # server name.
    #
    #<VirtualHost *:80>
    #    ServerAdmin webmaster@dummy-host.example.com
    #    DocumentRoot /www/docs/dummy-host.example.com
    #    ServerName dummy-host.example.com
    #    ErrorLog /var/log/httpd/dummy-host.example.com-error_log
    #    CustomLog /var/log/httpd/dummy-host.example.com-access_log common
    #</VirtualHost>
    
    ################################################################################
    # virtual hosts configuration section
    # Include virtual hosts, if any
    Include conf/vhosts.d/*.conf
    what this doesn't mention is that is you require ssl for your sites, you need to use ip based hosting, not name based.
    you cannot define multiple virtual hosts on one line, each host must be declared in it's own virtualhost container.
    the vh configuration location may be /etc/httpd/conf/vhosts.d/ so it might not be reading the configuration file.
    Last edited by Jaqui; 09-24-2006 at 02:31 AM.
    Quote Originally Posted by Jeff Henager
    If the average user can put a CD in and boot the system and follow the prompts, he can install and use Linux. If he can't do that simple task, he doesn't need to be around technology.

  3. #3
    User
    Join Date
    Jan 2006
    Location
    Canada
    Posts
    498
    Thanks for the help, but there is no line that loads conf/vhosts.d/*.conf. In the virtual hosts section, it reads the following:
    Code:
    Include sites-enabled/*
    I tried moving the virtual host section into a separate file in sites-available, and then sym-linking it from sites-enabled. I then got the following error when I restarted Apache:
    Code:
    [Sun Sep 24 15:14:33 2006] [warn] The ScriptAlias directive in /etc/apache2/sites-enabled/righton at line 46 will probably never match because it overlaps an earlier ScriptAlias.
    So at least it's trying to load it, but I don't know what to do now. I tried commenting out the entry I had previously in httpd.conf, but that didn't help.

  4. #4
    Registered User Jaqui's Avatar
    Join Date
    Feb 2005
    Posts
    416
    Why do you have the following defined twice?
    both directory settings blocks below are duplicated in your vh container.
    that is needlessly complex, making it harder to see what could be wrong, if not the cause of the issues.
    Code:
           <Directory /var/www/righton>
                    Options Indexes FollowSymLinks MultiViews
                    AllowOverride None
                    Order allow,deny
                    allow from all
                    # This directive allows us to have apache2's default start page
                    # in /apache2-default/, but still have / go to the right place
                    # Commented out for Ubuntu
                    #RedirectMatch ^/$ /apache2-default/
            </Directory>
    
            ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
            <Directory "/usr/lib/cgi-bin">
                    AllowOverride None
                    Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
                    Order allow,deny
                    Allow from all
            </Directory>
    Quote Originally Posted by Jeff Henager
    If the average user can put a CD in and boot the system and follow the prompts, he can install and use Linux. If he can't do that simple task, he doesn't need to be around technology.

  5. #5
    User
    Join Date
    Jan 2006
    Location
    Canada
    Posts
    498
    Quote Originally Posted by Jaqui
    Why do you have the following defined twice?
    both directory settings blocks below are duplicated in your vh container.
    that is needlessly complex, making it harder to see what could be wrong, if not the cause of the issues.
    Please forgive me! I'm still waking up.
    The errors went away, but it still doesn't work
    http://righton.ath.cx

  6. #6
    Registered User Jaqui's Avatar
    Join Date
    Feb 2005
    Posts
    416
    well, then that leaves the earlier parts of the httpd.conf in question.
    if the vh containers aren't tossing errors then there is something set to stop apache from using them.
    Quote Originally Posted by Jeff Henager
    If the average user can put a CD in and boot the system and follow the prompts, he can install and use Linux. If he can't do that simple task, he doesn't need to be around technology.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Virtual Box
    By ssharish2005 in forum Tech Board
    Replies: 3
    Last Post: 02-12-2009, 05:08 AM
  2. Replies: 48
    Last Post: 09-26-2008, 04:45 AM
  3. Program with Shapes using Virtual Functions
    By goron350 in forum C++ Programming
    Replies: 12
    Last Post: 07-17-2005, 02:42 PM
  4. C++ XML Class
    By edwardtisdale in forum C++ Programming
    Replies: 0
    Last Post: 12-10-2001, 11:14 PM
  5. Exporting Object Hierarchies from a DLL
    By andy668 in forum C++ Programming
    Replies: 0
    Last Post: 10-20-2001, 02:26 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21