Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a Plone server running on CentOS, I have multiple instances of Plone running 4.0 and 4.1, I also have multiple sites. I am new to linux and haveing problems getting Apache to work with multiple virtuale hosts. The first host listed works just fine but the second host does not. I get the following error message when I start HTTPD:

Starting httpd: [Mon Nov 07 14:38:31 2011] [warn] VirtualHost ordevel3.ucdavis.edu:80 overlaps with VirtualHost ordevel4.ucdavis.edu:80,
the first has precedence, perhaps you need a NameVirtualHost directive.

What am I missing to get the virtual hosts to work correctly?

Below in my syntax in httpd.conf.

 <VirtualHost ordevel3.abc.edu:80>
 ServerAlias   ordevel3.abc.edu 
 ServerAdmin   ortech@abc.edu
 ServerSignature On

    <IfModule mod_rewrite.c>
   RewriteEngine On

  # serving icons from apache 2 server
   RewriteRule ^/icons/ - [L]
   RewriteRule ^/(.*) \
      http://localhost:8080/VirtualHostBase/http/%{SERVER_NAME}:80/itsdevel3/VirtualHostRoot/$1 [L,P]

    </IfModule>

    <IfModule mod_proxy.c>
   ProxyVia On

   # prevent the webserver from beeing used as proxy
    <LocationMatch "^[^/]">
     Deny from all
    </LocationMatch>
    </IfModule>

    </VirtualHost>


    <VirtualHost ordevel4.abc.edu:80>
 ServerAlias   ordevel4.abc.edu
 ServerAdmin   ortech@abc.edu
 ServerSignature On

    <IfModule mod_rewrite.c>
   RewriteEngine On

  # serving icons from apache 2 server
   RewriteRule ^/icons/ - [L]
   RewriteRule ^/(.*) \
      http://localhost:8180/VirtualHostBase/http/%{SERVER_NAME}:80/ITS/VirtualHostRoot/$1 [L,P]

    </IfModule>

    <IfModule mod_proxy.c>
   ProxyVia On

   # prevent the webserver from beeing used as proxy
    <LocationMatch "^[^/]">
     Deny from all
    </LocationMatch>
    </IfModule>

    </VirtualHost>
share|improve this question

migrated from stackoverflow.com Nov 13 '11 at 6:03

This question came from our site for professional and enthusiast programmers.

1 Answer 1

You will need to change the following Lines:

<VirtualHost ordevel3.abc.edu:80>
  ServerAlias ServerAlias   ordevel3.abc.edu

The first line should contain an IP or * (Wildcard) instead of a domainname. If you want to use name based VirtualHosts you should define a ServerName. ServerAlias is only used to add aliases to a VirtualHost that has already a name.

So these lines should look as follows:

<VirtualHost *:80>
  ServerName   ordevel3.abc.edu

If this vhost should be accessible by the name sth.ordevel3.abc.edu you can add an alias:

  ServerAlias sth.ordevel3.abc.edu

If you still get the same error, you will have to make sure that your httpd.conf contains the following line to activate named virtual hosts:

NameVirtualHost *:80

For further information you can consult the Apache Manual:

PS: I didn't have a closer look at your redirects and other config since thats not the question.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.