Babu
Babu

Reputation: 2598

How to enable SSL for a whole django site with apache2+ubuntu 11?

I need to enable SSL for one of my entire django site. Currently the site is hosted with Apache2 in Ubuntu 11.1 and just accessible through http. I'd like to know the following,

1) Apache configuration for enabling ssl for this site.

2) Django related changes of the same, if any.

Another question of the same kind is unanswered, so asking here again.

Upvotes: 1

Views: 389

Answers (1)

Jingo
Jingo

Reputation: 3240

You may do it by adjusting your apache config like this:

# Turn on Rewriting
RewriteEngine on 

# Apply this rule If request does not arrive on port 443
RewriteCond %{SERVER_PORT} !443 

# RegEx to capture request, URL to send it to (tacking on the captured text, stored in $1), Redirect it, and Oh, I'm the last rule.
RewriteRule ^(.*)$ https://www.x.com/dir/$1 [R,L]

Note that this is taken from https://serverfault.com/questions/77831/how-to-force-ssl-https-on-apache-location.

There shouldnt be any changes necessary for django. HTH.

Upvotes: 1

Related Questions