Question: How to set up multiple websites in single IP

Discussion in 'Server Operation' started by hhhhhh, Mar 2, 2011.

  1. hhhhhh

    hhhhhh New Member

    Hello,

    I was trying to configure the apache2, reading apache website, many tutorials and I think that I have all done, but one of the 2 domains configured doesn't run.

    I have domain1.com and domain2.com
    domain1.com runs perfectly, but when I try the domain2.com it goes to domain1.com

    Could you help me?

    Here is the code inside the sites-available folder:

    Code:
    NameVirtualHost 12.345.67.89:80
    <VirtualHost www.domain1.com:80>
            ServerAdmin [email protected]
            ServerName www.domain1.com
            ServerAlias domain1.com
            DocumentRoot /var/www_domain1/
            <Directory />
                    Options FollowSymLinks
                    AllowOverride None
            </Directory>
            <Directory /var/www_domain1/>
                    Options Indexes FollowSymLinks MultiViews
                    AllowOverride All
                    Order allow,deny
                    allow from all
            </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-domain1.log
    
            # Possible values include: debug, info, notice, warn, error, crit,
            # alert, emerg.
            LogLevel warn
    
            CustomLog /var/log/apache2/access-domain1.log combined
            ServerSignature On
    
    </VirtualHost>
    
    <VirtualHost www.domain2.com:80>
            ServerAdmin [email protected]
            ServerName www.domain2.com
            ServerAlias domain2.com
            DocumentRoot /var/www_domain2/
            <Directory />
                    Options FollowSymLinks
                    AllowOverride None
            </Directory>
            <Directory /var/www_domain2/>
                    Options Indexes FollowSymLinks MultiViews
                    AllowOverride All
                    Order allow,deny
                    allow from all
            </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-domain2.log
    
            # Possible values include: debug, info, notice, warn, error, crit,
            # alert, emerg.
            LogLevel warn
    
            CustomLog /var/log/apache2/access-domain2.log combined
            ServerSignature On
    
    </VirtualHost>
    
    
    Awaiting your news.
    Thx
     
  2. falko

    falko Super Moderator ISPConfig Developer

    Please try
    Code:
    <VirtualHost 12.345.67.89:80>
    instead of
    Code:
    <VirtualHost www.domain1.com:80>
    and
    Code:
    <VirtualHost www.domain2.com:80>
     
  3. hhhhhh

    hhhhhh New Member

    Thank you falko!
    It works!
     

Share This Page