Ubuntu – Apache virtual hosts not working

14.04Apache2virtualhost

I have production server with apache/2.4.7 on ubuntu 14.04. I have several virtual hosts on it. This server located on hetzner. I decide to transfer my server on more powerfull server. I create snapshot of my old server and transfer it on new. Everything work fine but when i try to access on one of my domains that i transfer on new server i got just default apache webpage that stored on 000-default.conf on line:

DocumentRoot /var/www/html

i tried to aplly this command:

a2ensite mysite.conf

but i got this message: Site mysite already enabled
i tried to a2dissite mysite.conf restart server, a2ensite mysite.conf then restart server once again. but i still got default page. Here is example of mysite:

<VirtualHost mysite.com.ua:80>
    ServerName mysite.com.ua
    ServerAlias www.mysite.com.ua
    WSGIDaemonProcess mysite processes=2 threads=15 display-name=%{GROUP} python-path=/var/www/mysite
    WSGIProcessGroup mysite

    WSGIScriptAlias / /var/www/mysite/mysite/wsgi.py

    <Directory /var/www/mysite/mysite>
        Require all granted
    </Directory>

    CustomLog /var/www/mysite/logs/apache_access.log combined
    ErrorLog /var/www/mysite/logs/apache_error.log

    Alias /static/ /var/www/mysite/static/
    <Directory /var/www/mysite/>
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Require all granted
    </Directory>

    Alias /media/ /var/www/mysite/media/
    <Directory /var/www/mysite/>
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Require all granted
    </Directory>
</VirtualHost>

here is my 000-default.conf:

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

As you can see i use wsgi, but it still doesn't work when i use pure html. Can somebody help me with it. Thanks

Best Answer

Change <VirtualHost mysite.com.ua:80> with <VirtualHost *:80>.

I don't know what is the reason of this behaviour, but I had similar problem while ago, and this was the solution. Maybe it is connected with /etc/hosts.

It would be good someone, who knows the reason, give us an explanation.