1

django サイト全体の 1 つで SSL を有効にする必要があります。現在、このサイトは Ubuntu 11.1 の Apache2 でホストされており、http からのみアクセスできます。次のことを知りたいのですが、

1) このサイトで SSL を有効にするための Apache 構成。

2) Django 関連の同じ変更がある場合。

同じ種類の別の質問が回答されていないため、ここで再度質問します。

4

1 に答える 1

1

あなたはこのようにあなたのapache設定を調整することによってそれをするかもしれません:

# 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]

これはhttps://serverfault.com/questions/77831/how-to-force-ssl-https-on-apache-locationから取得されていることに注意してください。

djangoに必要な変更はありません。HTH。

于 2012-06-22T11:15:17.947 に答える