Here are your configs; reformatted my me for readability:
<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 assuming if you have a virtual host setup in place, if you attempt to access the website via the IP address of 52.79.**.**:80
everything is fine, but if you are accessing it via a hostname/domain name like example.com
then it is choking, correct? If that is the case what you need to do is set the virtual host lines like this:
<VirtualHost *:80>
And this for HTTPS:
<VirtualHost *:443>
Then within those config blocks you would set a ServerName
value like this; of course this is not a full config but just a example of what you should change:
<VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www/qna ServerName www.example.com ServerAlias www example.* www.example.*
Doing something like this would allow the virtual host config to work correctly with www.example.com
being the actual server name connected to that config and then ServerAlias
allows the config to capture other variants of www.example.com
such as example.com
or www.example.net
.