0

我正在使用基于 django 的框架,并且已经成功计算出 http 模式的 Apache 设置。基本上我已经正确地完成了设置<VirtualHost *:80> ... </VirtualHost>,当我这样做时, http: //mysite.domain.com我被正确地路由到我的站点并且站点页面和皮肤得到正确呈现。

我已经设置https://mysite.domain.com与 shibboleth 一起工作,shibboleth 正在工作,当使用 https 时,我通过 shibboleth 服务器被路由到登录凭据页面,成功登录后,我被重定向到https://mysite。 domain.com但网站无法正确呈现,并且外观与http://mysite.domain.com不同。

这是我的 Apache 设置,我试图了解我在这里做错了什么

<VirtualHost *:443>
     ServerAdmin myname@mydomain.com
     DocumentRoot /code/vEnviornment/mysite
     ServerName mydomain.com
     #<LocationMatch "^(?!/admin)">
     #<LocationMatch "^(?!/m)">
     #    RewriteEngine on
     #    RewriteRule django.wsgi(.*)$ https://mydomain.com:443$1 [L,R=301]
     #</LocationMatch>
     SSLEngine on
     #your SSL keys
     #I have removed this wasn't comfortable putting SSL key info
     #Alias /admin/media/ /usr/local/lib/python2.6/site-packages/django/contrib/admin/media/
     Alias /admin/media/ /usr/local/lib/python2.7/dist-packages/django/contrib/admin/media/
     WSGIScriptAlias /m/ /code/vEnviornment/mysite/django.wsgi
     <Directory "/">
     AuthType shibboleth
     ShibRequestSetting requireSession 1
     Require valid-user
     </Directory>
     Alias /Shibboleth.sso /tmp
     #    CustomLog /var/log/httpd/mysite/access_log common
     #    ErrorLog /var/log/httpd/mysite/error_log
    CustomLog /var/log/apache2/mysite/access_log common
    ErrorLog /var/log/apache2/mysite/error_log
</VirtualHost>

这就是我如何拥有 hetup http:

<VirtualHost *:80>
     ServerAdmin myname@mydomain.com
     DocumentRoot /code/vEnviornment/mysite
     ServerName mysite.mydomain.com

     #aliases to serve static media directly
     #will probably need adjustment
     Alias /m/ /code/vEnviornment/mysite/static/
     Alias /upfiles/ /code/vEnviornment/mysite/myframework/upfiles/
     <DirectoryMatch "/code/vEnviornment/mysite/myframework/skins/([^/]+)/media">
        Order deny,allow
        Allow from all
     </DirectoryMatch>
     <Directory "/code/vEnviornment/mysite/myframework/upfiles">
        Order deny,allow
        Allow from all
     </Directory>
     #must be a distinct name within your apache configuration
     WSGIDaemonProcess mysite2
     WSGIProcessGroup mysite2
     WSGIScriptAlias / /code/vEnviornment/mysite/django.wsgi
     #make all admin stuff except media go through secure connection
     <LocationMatch "/admin(?!/media)">
     RewriteEngine on
         RewriteRule /admin(.*)$ https://128.101.35.71/admin$1 [L,R=301]
     </LocationMatch>
    # CustomLog /var/log/httpd/mysite/access_log common
    # ErrorLog /var/log/httpd/mysite/error_log
    CustomLog /var/log/apache2/mysite/access_log common
    ErrorLog /var/log/apache2/mysite/error_log
    LogLevel debug
</VirtualHost>

我在这里做错了什么以通过https 错误地呈现网站?

4

1 回答 1

0
Alias /m/ /code/vEnviornment/mysite/static/
 Alias /upfiles/ /code/vEnviornment/mysite/myframework/upfiles/

https 虚拟主机中缺少这两行

你的 WSGIScriptAlias 应该指向 / 而不是 /m/

于 2013-05-06T13:17:48.227 回答