I've got a django application and I must apply SSL towards the admin pages. Because the admin page would be the only pages requiring SSL I do while using apache configuration files and never using SSLMiddleware. My (partial) apache configuration files seem like this:
<VirtualHost *:80> . . DocumentRoot /home/www/sites_django/wmssite . <Directory "/home/www/sites_django/wmssite"> . </Directory> <Location "/admin"> RewriteEngine On RewriteRule ^/(.*) https://www.whitemoorstudio.pvm/admin [L,R=301] </Location> </VirtualHost> <VirtualHost *:443> SSLEngine on SSLCertificateFile "/usr/local/etc/apache22/www_whitemoorstudio_pvm.crt" SSLCertificateKeyFile "/usr/local/etc/apache22/www_whitemoorstudio_pvm.key" . . </VirtualHost>
The TLD .pvm is really a local TLD I simply use for testing on my small internal network.
I've setup a self-sgned certificate and delay pills work, well.... kind of. The strange factor is the fact that for whatever reason when spinning to https it can't discover the media files within the /media directory, no images, no css, no js. The apache error log informs me it's searching within the directory /usr/local/www/apache22/data/media:
[Sat Nov 06 20:45:18 2010] [error] [client 192.168.1.134] File does not exist: /usr/local/www/apache22/data/media, referer: https://www.whitemoorstudio.pvm/admin/
After I don't rewrite to https the admin media directory /usr/local/www/apache22/media. Ezinearticles media is really a logical link:
media -> /usr/local/lib/python2.5/site-packages/django/contrib/admin/media
I've no clue why without SSL it's searching in:
with SSL in:
This last directory does not exist!!!
Anybody any idea?
Problem already solved. When adding the stuff within the VirtualHost *:443 container
I'd forgotten to specify the DocumentRoot directive therefore it was as specified by the primary httpd.conf.
It went well within the VirtualHost *:80 container because for the reason that section I'd specified DocumentRoot.
In httpd.conf it's specified as: DocumentRoot "/usr/local/www/apache22/data"