Why my website work on: http://example.com but on www.example.com not working?

<VirtualHost *:80>
        ServerName www.example.com
        ServerAlias example.com
        Alias /static/ /home/ubuntu/proj/proj/static/

        DocumentRoot /home/ubuntu/proj
        WSGIScriptAlias / /home/ubuntu/proj/proj/index.wsgi


        ErrorLog /var/log/apache2/error.log
        LogLevel warn
        CustomLog /var/log/apache2/access.log combined
</VirtualHost>

Why my website work on:

http://example.com but on www.example.com not working?


Solution 1:

Looks like www.example.com and example.com are not the same machine. Check your DNS and ensure that www.example.com and example.com resolve to the same IP address.

Take appropriate action.