如何使用Apache + Fastcgi + Django启用SSL支持?

时间:2014-01-17 00:26:50

标签: django apache https fastcgi httpd.conf

我编写了一个Django应用程序,我想在部署中启用SSL(Https)支持。目前我的web应用程序在port80上正确提供。这是我的设置

  1. 我使用Apache作为我的网络服务器
  2. FastCGI作为反向代理来提供我的网络应用
  3. 我使用以下命令启动我的Django应用程序

    /usr/bin/python manage.py runfcgi daemonize=false method=threaded host=127.0.0.1 port=8080
    

    我相应地编辑了Apache httpd.conf文件

    <VirtualHost _default_:80>
    
        Alias /static /opt/tms/web3/static
    
        #For every request that *doesn't* start with "static", send it
        #to Django via fastcgi.  The address and port must match the
        #arguments that are later passed to Django.
        <LocationMatch "^/(?!static)">
            ProxyPass fcgi://127.0.0.1:8080/
        </LocationMatch>
    
    </VirtualHost>
    
    
    <VirtualHost _default_:443>
    
        Alias /static /opt/tms/web3/static
    
        #For every request that *doesn't* start with "static", send it
        #to Django via fastcgi.  The address and port must match the
        #arguments that are later passed to Django.
        <LocationMatch "^/(?!static)">
            ProxyPass fcgi://127.0.0.1:8080/
        </LocationMatch>
    
        LogLevel warn
        ErrorLog /var/log/web_error_log
        LogFormat combined
        CustomLog /var/log/web_access_log combined
    
        SSLEngine on
        SSLCertificateFile       /var/opt/tms/web/conf/webserver.cert.pem
        SSLCertificateKeyFile    /var/opt/tms/web/conf/webserver.priv.pem
        SSLCertificateChainFile  /var/opt/tms/web/conf/webserver_chain.cert.pem
        SSLOptions +StdEnvVars
        SSLProtocol -all +TLSv1 +TLSv1.1 +TLSv1.2
        SSLCipherSuite HIGH:-aNULL:-kKRB5:-MD5
    
        FileETag None
    </VirtualHost>
    

    我使用https

    访问时出现此错误
    Unable to make a secure connection to the server. This may be a problem with 
    the server, or it may be requiring a client authentication certificate that you don't have.
    Error code: ERR_SSL_PROTOCOL_ERROR
    

0 个答案:

没有答案