I'm working with Python, Flask and Apache, and i'm stuck. when i try to visit mywebsite using www, it works fine. however, when i remove the www, the website is showing "index of /" with an empty list of files next. i've read all the possible solutions, nothing works in my case. i'm working with WSGI which means that DocumentRoot is irrelevant because i'm using the WSGIScriptAlias variable. i'm using the ServerAlias as instructed - doesn't help. i've set up 2 seperate A records in my dns options, both point to the same ip. when i ping the website with www and without it, the same ip address is showing
<VirtualHost *:80>
ServerName mysite.com
ServerAlias www.mysite.com
WSGIScriptAlias / /var/www/mysite/mysite.wsgi
<Directory /var/www/mysite/mysite/>
Order allow,deny
Allow from all
</Directory>
Alias /static /var/www/mysite/mysite/app/static
<Directory /var/www/mysite/mysite/app/static/>
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
...
</VirtualHost>
any ideas?
This is the output of the "apachectl -S" command:
VirtualHost configuration:
*:80 is a NameVirtualHost
default server mysite.com (/etc/apache2/sites-enabled /000-default.conf:1)
port 80 namevhost mysite.com (/etc/apache2/sites-enabled /000-default.conf:1)
port 80 namevhost mysite.com (/etc/apache2/sites-enabled /mysite.conf:1)
alias www.mysite.com
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex watchdog-callback: using_defaults
Mutex default: dir="/var/lock/apache2" mechanism=fcntl
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33
Group: name="www-data" id=33