Disclaimer: I do not fully realize what I am doing, and so i might have phrased things wrong. I have also never requested/clarified an issue on here before!
I've got a Django application running on Apache which i used using mod_wsgi and virtualenv. I would like certain parts from the application to make use of SSL, however, if I install the SSL certificate, the https URL would go to the index.html file from my public_html folder rather than the application (that is outdoors of public_html)
I have looked stackoverflow and Google all day long. I have attempted getting rid of the documentroot in the virtual hosts file but that didn't do anything. I attempted adding a SetEnvIf X-Submitted-Proto https HTTPS=1 line into it but that didn't do anything either.
My virtual hosts file has wrinkles inside it:
SSLEngine on SSLCertificateFile /etc/ssl/certs/tradekandi.com.crt SSLCertificateKeyFile /etc/ssl/private/tradekandi.com.key SSLCACertificateFile /etc/ssl/certs/tradekandi.com.cabundle
Whenever I make any changes, I restart apache and "touch" the app's wsgi file.
How do i result in the https URL load the Django application? Any help could be much appreciated. Thanks.
Much more of httpd configuration:
<VirtualHost 188.8.131.52:80> ServerName tradekandi.com ServerAlias world wide web.tradekandi.com DocumentRoot /home/trade/public_html ServerAdmin website email@example.com UseCanonicalName Off CustomLog /usr/local/apache/domlogs/tradekandi.com combined CustomLog /usr/local/apache/domlogs/tradekandi.com-bytes_log "%t %I .n%t %O ." ## User trade # Required for Cpanel::ApacheConf <IfModule mod_suphp.c> suPHP_UserGroup trade trade </IfModule> <IfModule !mod_disable_suexec.c> SuexecUserGroup trade trade </IfModule> ScriptAlias /cgi-bin/ /home/trade/public_html/cgi-bin/ Include "/usr/local/apache/conf/userdata/*.conf" Include "/usr/local/apache/conf/userdata/*.owner-root" Include "/usr/local/apache/conf/userdata/std/*.conf" Include "/usr/local/apache/conf/userdata/std/*.owner-root" Include "/usr/local/apache/conf/userdata/std/2/*.conf" Include "/usr/local/apache/conf/userdata/std/2/*.owner-root" Include "/usr/local/apache/conf/userdata/std/2/trade/*.conf" Include "/usr/local/apache/conf/userdata/std/2/trade/tradekandi.com/*.conf" </VirtualHost> <VirtualHost 184.108.40.206:443> ServerName tradekandi.com ServerAlias world wide web.tradekandi.com DocumentRoot /home/trade/public_html ServerAdmin website firstname.lastname@example.org UseCanonicalName Off CustomLog /usr/local/apache/domlogs/tradekandi.com combined CustomLog /usr/local/apache/domlogs/tradekandi.com-bytes_log "%t %I .n%t %O ." ## User nobody # Required for Cpanel::ApacheConf <IfModule mod_suphp.c> suPHP_UserGroup nobody nobody </IfModule> ScriptAlias /cgi-bin/ /home/trade/public_html/cgi-bin/ SSLEngine on SSLCertificateFile /etc/ssl/certs/tradekandi.com.crt SSLCertificateKeyFile /etc/ssl/private/tradekandi.com.key SSLCACertificateFile /etc/ssl/certs/tradekandi.com.cabundle CustomLog /usr/local/apache/domlogs/tradekandi.com-ssl_log combined SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown <Directory "/home/trade/public_html/cgi-bin"> SSLOptions +StdEnvVars </Directory> Include "/usr/local/apache/conf/userdata/*.conf" </VirtualHost>
Whether it's relevant, this can be a devoted server running CentOS &lifier I'm also utilizing it to host one PHP-based site.
import os import sys sys.stdout = sys.stderr from os.path import abspath, dirname, join from site import addsitedir sys.path.append('/home/trade/sites/tradekandi.com.env/lib/python2.7/site-packages') sys.path.place(, abspath(join(dirname(__file__), "../../"))) from django.conf import configurations os.environ["DJANGO_Configurations_MODULE"] = "trade.configurations" sys.path.place(, join(configurations.PROJECT_ROOT, "applications")) from django.core.handlers.wsgi import WSGIHandler application = WSGIHandler()
extra.conf with mod_wsgi directives:
Alias /static/ /home/trade/public_html/static/ <Directory /home/trade/public_html/static> Order deny,allow Allow all </Directory> WSGIDaemonProcess trade python-path=/home/trade/sites/tradekandi.com.env/lib/python2.7/site-packages WSGIProcessGroup trade WSGIScriptAlias / /home/trade/sites/tradekandi.com.env/site/trade/deploy/pinax.wsgi <Directory /home/trade/sites/tradekandi.com.env/site/trade/deploy> Order deny,allow Allow all </Directory>