简体   繁体   中英

apache Vhost opens other Vhost

I have set up an Ubuntu 14.04 apache2 server with 4 different vhosts as shown below. Problem I have is when I start apache and open www.site1.io and then trying opening www.site2.io - it opens www.site1.io instead.

for example:

  1. open www.site1.io/admin
  2. open www.site2.io
  3. redirects me to www.site2.io/admin and shows www.site1.io/admin page under the site2 URL

Here are my Vhosts:

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

<VirtualHost *:80>
        ServerName www.pma.io
        ServerAlias pma.io
        DocumentRoot /var/www/html/phpmyadmin
        ErrorLog /var/www/html/logs/pma.io/error.log
        CustomLog /var/www/html/logs/pma.io/access.log common
        <Directory /var/www/html/phpmyadmin>
                AllowOverride All
                Order allow,deny
                Allow from all
        </Directory>
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "/var/www/html/site1.io"
    ServerName www.site1.io
    ServerAlias site1.io
    ErrorLog /var/www/html/logs/site1.io/error.log
    CustomLog /var/www/html/logs/site1.io/access.log common
    <Directory /var/www/html/site1.io>
            AllowOverride All
            Order allow,deny
            Allow from all  
    </Directory>
</VirtualHost>

<VirtualHost *:80>
        DocumentRoot "/var/www/html/site2.io"
        ServerName www.site2.io
        ServerAlias site2.io
        ErrorLog /var/www/html/logs/site2.io/error.log
        CustomLog /var/www/html/logs/site2.io/access.log common
        <Directory /var/www/html/site2.io>
                AllowOverride All
                Order allow,deny
                Allow from all  
        </Directory>
</VirtualHost>

apachectl -s output:

VirtualHost configuration:
*:80                   is a NameVirtualHost
         default server 127.0.0.1 (/etc/apache2/sites-enabled/000-default.conf:1)
         port 80 namevhost 127.0.0.1 (/etc/apache2/sites-enabled/000-default.conf:1)
         port 80 namevhost www.site1.io (/etc/apache2/sites-enabled/site1.io.conf:1)
                 alias site1.io
         port 80 namevhost www.site2.io (/etc/apache2/sites-enabled/site2.io.conf:1)
                 alias site2.io
         port 80 namevhost www.pma.io (/etc/apache2/sites-enabled/phpmyadmin.conf:1)
                 alias pma.io

hosts file:

127.0.0.1       pma.io
127.0.0.1       www.pma.io
127.0.0.1       site1.io
127.0.0.1       www.site1.io
127.0.0.1       site2.io
127.0.0.1       www.site2.io

thanks for help

solution: Dont mess with php5-xcache module

disabled it and everything is going fine

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM