2012-10-01 68 views
1

SSL Django的應用程序我已經安裝在ubuntu lucidapache2,並啓用ssl。現在我正在運行的應用程序django(可以說myapp1)它使用mod_wsgi上。 我已經配置了/etc/apache2/sites_enabled/ssl文件和/etc/apache2/sites-available/ssl如下。運行兩個在同一個Apache服務器

現在,我可以使用url

https://127.0.0.1/myapp1 

我需要在同一臺服務器上運行的另一個Django應用程序(比如myapp2)運行我的應用程序,並且還使用了SSL.So,我應該如何配置呢?有人能幫幫我嗎?

<VirtualHost *:443> 
    ServerAdmin [email protected] 

    DocumentRoot /home/me/dev/python/django/myapp1 

     SSLEngine on 
     SSLOptions +StrictRequire 
     SSLCertificateFile /etc/ssl/certs/server.crt 
     SSLCertificateKeyFile /etc/ssl/private/server.key 
    <Directory /> 
     Options FollowSymLinks 
     AllowOverride None 
    </Directory> 
    <Directory /var/www/> 
     Options Indexes FollowSymLinks MultiViews 
     AllowOverride None 
     Order allow,deny 
     allow from all 
    </Directory> 

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ 
    <Directory "/usr/lib/cgi-bin"> 
     AllowOverride None 
     Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch 
     Order allow,deny 
     Allow from all 
    </Directory> 

    ErrorLog /var/log/apache2/error.log 
    # Possible values include: debug, info, notice, warn, error, crit, 
    # alert, emerg. 
    LogLevel warn 

    CustomLog /var/log/apache2/access.log combined 
    WSGIScriptAlias /myapp1 /home/me/dev/python/django/myapp1/myapp1.wsgi 
    Alias /site_media/ /home/me/dev/python/django/myapp1/media/ 
    Alias /doc/ "/usr/share/doc/" 
    <Directory "/usr/share/doc/"> 
     Options Indexes MultiViews FollowSymLinks 
     AllowOverride None 
     Order deny,allow 
     Deny from all 
     Allow from 127.0.0.0/255.0.0.0 ::1/128 
    </Directory> 

</VirtualHost> 

回答

0

通過添加:

WSGIScriptAlias /myapp2 /home/me/dev/python/django/myapp2/myapp2.wsgi 

您需要解決任何衝突但如果它們不能共享相同的靜態媒體文件。也就是說,讓每個媒體都在不同的位置,併爲每個Django項目適當地配置設置。

相關問題