2013-05-06 47 views
0

我正在嘗試創建一個小型django站點並使用iRedMail進行電子郵件。我首先安裝了iRedMail,並確保它可以正常工作。我可以同時訪問www.domain.com/iredadmin和www.domain.com/mail並使其完美工作。我的下一步是安裝我的django站點並配置Apache。不幸的是,這導致我的django網站嘗試處理/郵件/和/ iredadmin /。我一直在忙着配置幾個小時,不知道該怎麼做。具體設置如下:在同一臺服務器上使用帶有Django站點的iRedMail

apache2.conf:啓用站點-

# Defaults... 

WSGIPythonPath /path/to/website.com/website 

/website.com:

<VirtualHost *:80> 
    ServerName website.in 
    ServerAlias www.website.in 
    ErrorLog ${APACHE_LOG_DIR}/error.log 

    Alias /static /path/to/website.com/website/static 
    Alias /media /path/to/website.com/website/media 
    Alias /mail /usr/share/apache2/roundcubemail/ 
    Alias /admin /usr/share/apache2/iredadmin/ 


    <Directory /usr/share/apache2/roundcubemail/> 
     Order allow,deny 
     Allow from all 
    </Directory> 

    WSGIScriptAlias//path/to/website.com/website/website.wsgi 

    <Location "/"> 
      SetHandler python-program 
      PythonHandler django.core.handlers.modpython 
      SetEnv DJANGO_SETTINGS_MODULE website.settings 
      PythonDebug Off 
      PythonPath "['/path/to/website.com/website/']+sys.path" 
    </Location> 

    <Directory /path/to/website.com/website> 
     <Files wsgi.py> 
      Order deny,allow 
      Allow from all 
     </Files> 
    </Directory> 

    <Directory /path/to/website.com/website/static> 
     Order allow,deny 
     Allow from all 
    </Directory> 

    <Location /static/> 
     SetHandler None 
    </Location> 

    <Directory /path/to/website.com/website/media> 
     Order allow,deny 
     Allow from all 
    </Directory> 

    <Location /media/> 
     SetHandler None 
    </Location> 

</VirtualHost> 

Django的網站顯示細膩,雖然我已經越來越內部服務器錯誤。

回答

0

您正在嘗試同時使用mod_wsgi和mod_python來處理Django站點,並使用mod_python覆蓋mod_wsgi。選擇其中一個。由於mod_python不再被開發或支持,並且在Django中不支持它,可能不是繼續使用它的好選擇。

這是不對的下一件事是:

Alias /mail /usr/share/apache2/roundcubemail/ 
Alias /admin /usr/share/apache2/iredadmin/ 

刪除尾隨斜線:

Alias /mail /usr/share/apache2/roundcubemail 
Alias /admin /usr/share/apache2/iredadmin 

即使如此,它仍然無法正常工作,因爲使用了mod_python時,你必須告訴mod_python的不處理這些路徑。

<Location /mail/> 
    SetHandler None 
</Location> 

<Location /admin/> 
    SetHandler None 
</Location> 

你可能有進一步的問題是,/管理員通常用於Django管理界面,你將覆蓋這一點。

相關問題