Typing in the domain name in a brower shows the "index of /" page, instead of the content of my website. I'm using django, mod-wsgi and apache on ec2.
My apache conf file looks like this:
<VirtualHost 52.79.**.**:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/qna
Alias /m/ /var/www/qna/static/
Alias /upfiles/ /var/www/qna/askbot/upfiles/
<DirectoryMatch “/var/www/qna/askbot/skins/([^/]+)/media”>
Require all granted
</DirectoryMatch>
<Directory “/var/www/qna/askbot/upfiles”>
Require all granted
</Directory>
WSGIDaemonProcess qna
WSGIProcessGroup qna
WSGIScriptAlias / /var/www/qna/django.wsgi
<LocationMatch “(?!/m)/admin(?!/media)”>
RewriteEngine on
RewriteRule /admin(.*)$ https://mywebsite.com/admin$1 [L,R=301]
</LocationMatch>
CustomLog /var/log/apache2/t_access_log common
ErrorLog /var/log/apache2/qna_error_log
LogLevel debug
</VirtualHost>
<VirtualHost 52.79.**.**:443>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/qna
<LocationMatch "^(?!/admin)">
RewriteEngine on
RewriteRule django.wsgi(.*)$ http://mywebsite.com$1 [L,R=301]
</LocationMatch>
SSLEngine on
SSLCertificateFile /etc/ssl/private/qna.crt
SSLCertificateKeyFile /etc/ssl/private/qna.key
Alias /admin/media/ /usr/local/lib/python2.7/dist-packages/django/contrib/admin/static/media/
Alias /m/ /var/www/qna/static/
WSGIScriptAlias / /var/www/qna/django.wsgi
CustomLog /var/log/apache2/qna_access_log common
ErrorLog /var/log/apache2/qna_error_log
</VirtualHost>
I am a newbie and I assume there is something fundamentally wrong with the apache setting. I've spent the last four days on this, tried everything to resolve this but solved nothing.
I assume that there is something wrong with WSGI setting because apache does not understand django. The settings.py file is in /var/www/qna.
Django 1.8.8 and Python 2.7.6, on Amazon ec2 Ubuntu. Thank you in advance. Please help.
I tried changing to and added ServerName mysite.com and also ServerAlias but in this case I get 500 Internal Server Error.
VirtualHost configuration:
*:80 mysite.com (/etc/apache2/sites-enabled/qna.conf:1)
*:443 mysite.com (/etc/apache2/sites-enabled/qna.conf:31)
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex rewrite-map: using_defaults
Mutex ssl-stapling: using_defaults
Mutex ssl-cache: using_defaults
Mutex default: dir="/var/lock/apache2" mechanism=fcntl
Mutex watchdog-callback: using_defaults
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33 not_used
Group: name="www-data" id=33 not_used
But when I run python maange.py runserver 0.0.0.0:80
it works fine with no problem. I can access the website typing the domain name.
DirectoryIndex
, I can see in Jake's reformatted config that there is an alias for /.