Jump to content

Problem with virtual hosts


Ciekawy

Recommended Posts

I have a weird problem that i cannot find answer for anywhere.

I have a DYNDNS domain (somedomain.selfip.org) with wildcards enabled that points to a router/firewall/NAT running Tomato (a.somedomain.selfip.org). On the router i have a forwarding of port 80 enabled pointing to a host on a local network (b.somedomain.selfip.org), that is running a Apache 2.2 server. On that server i would like to host following domains:

 

1. somedomain.selfip.org, www.somedomain.selfip.org, b.somedomain.selfip.org, b

    pointing to /var/www/apache2-default

2. user1.somedomain.selfip.org, user2.somedomain.selfip.org

    pointing to /var/www/user12

 

My current config is:

In /etc/apache2/httpd.conf

NameVirtualHost *:80

<IfModule mod_ssl.c>
    NameVirtualHost *:443
</IfModule>

 

In /etc/apache2/sites-available/default

<VirtualHost *:80>
    ServerName somedomain.selfip.org
    ServerAlias somedomain.selfip.org b.somedomain.selfip.org b
    ServerAdmin [email protected]
    DocumentRoot /var/www/apache2-default/

    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>

    <Directory /var/www/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
    </Directory>

    ErrorLog /var/log/apache2/default/error.log
    LogLevel debug

    CustomLog /var/log/apache2/default/access.log combined
    ServerSignature On
</VirtualHost>

 

In /etc/apache2/sites-available/user12

<VirtualHost *:80>
    ServerName user1.somedomain.selfip.org
    ServerAlias user2.somedomain.selfip.org
    ServerAdmin [email protected]
    DocumentRoot /var/www/user12/

    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>

    <Directory /var/www/user12/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
    </Directory>

    ErrorLog /var/log/apache2/user12/error.log
    LogLevel debug

    CustomLog /var/log/apache2/user12/access.log combined
    ServerSignature On
</VirtualHost>

 

The problem is that whatever subdomain i enter:

user1.somedomain.selfip.org

user1.somedomain.selfip.org

(even a non-existent ones line - idontexist.somedomain.selfip.org) i get the site form first virtual host.

What could be the problem.

 

Ciekawy

Link to comment
https://forums.phpfreaks.com/topic/127108-problem-with-virtual-hosts/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.