Home

Tags

wsgi ssl (https) на apache

2010-06-04 apache ssl wsgi https

Пример настройки wsgi приложения через ssl
Проверено на ubuntu 10.04

Включаем модуль ssl

sudo a2enmod ssl


Создаем конфигурацию виртуального хоста: /etc/apache2/sites-available/mysite-ssl
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
    ServerName localhost
    ServerAdmin webmaster@localhost

    WSGIDaemonProcess main user=www-data group=www-data processes=1 threads=5
    WSGIScriptAlias / /var/www/main/index.wsgi

    <Directory /var/www/main>
        WSGIProcessGroup main
        WSGIApplicationGroup %{GLOBAL}
        Order deny,allow
        Allow from all
    </Directory>

    ErrorLog /var/log/apache2/error.log
    LogLevel warn
    CustomLog /var/log/apache2/ssl_access.log combined

    #   SSL Engine Switch:
    SSLEngine on
    SSLCertificateFile    /etc/ssl/certs/ssl-cert-snakeoil.pem
    SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key

    BrowserMatch "MSIE [2-6]" \
	    nokeepalive ssl-unclean-shutdown \
	    downgrade-1.0 force-response-1.0
    # MSIE 7 and newer should be able to use keepalive
    BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
</VirtualHost>
</IfModule>


Подключаем эту конфигурацию
sudo a2ensite mysite-ssl


Перезагружаем apache
sudo /etc/init.d/apache2 restart


В файл /var/www/main/index.wsgi пишем само wsgi приложение.

comments powered by Disqus