English 中文(简体)
带有WSGI的Apache2上的SSL[已关闭]
原标题:SSL on Apache2 with WSGI [closed]

这个问题似乎不是关于特定的编程问题、软件算法或主要由程序员使用的软件工具。如果您认为该问题在另一个Stack Exchange站点,您可以留下评论,解释在哪里可以回答问题。

Closed 9 years ago.

我正试图在我维护的Django网站上设置SSL,但在使用SSL设置VirtualHost时遇到了一些问题。我遵循了说明这里但每次我尝试重新启动apache时,它都会告诉它无法重新启动,因为有多个虚拟主机使用相同的wsgi配置:

/etc/init.d/apache2 reload
Syntax error on line 33 of /etc/apache2/sites-enabled/www.mydomain.com:
Name duplicates previous WSGI daemon definition.
...fail!

我理解正在发生的事情,只是不知道如何解决。任何建议都将不胜感激,谢谢!以下是我的VirutalHosts文件的样子:

<VirtualHost *:80>
    ServerAdmin my@email.com
    ServerName mydomain.com
    ServerAlias www.mydomain.com
    DocumentRoot /sites/mydomain

    # WSGI Settings
    WSGIScriptAlias / /sites/mydomain/wsgi_handler.py
    WSGIDaemonProcess mydomain user=myuser group=mygroup processes=1 threads=1
    WSGIProcessGroup mydomain

    # Static Directories
    Alias /static /sites/mydomain/static/
    <Location "/static">
            SetHandler None
    </Location>

    Alias /img /sites/mydomain/img/
    <Location "/img">
            SetHandler None
    </Location>

</VirtualHost>

<VirtualHost *:443>
    ServerAdmin my@email.com
    ServerName mydomain.com
    ServerAlias www.mydomain.com
    DocumentRoot /sites/mydomain

    # WSGI Settings
    WSGIScriptAlias / /sites/mydomain/wsgi_handler.py
    WSGIDaemonProcess mydomain user=myuser group=mygroup processes=1 threads=1
    WSGIProcessGroup mydomain

    # Static Directories
    Alias /static /sites/mydomain/static/
    <Location "/static">
            SetHandler None
    </Location>

    Alias /img /sites/mydomain/img/
    <Location "/img">
            SetHandler None
    </Location>

    # SSL Stuff
    SSLEngine On
    SSLCertificateFile /etc/apache2/ssl/crt/vhost1.crt
    SSLCertificateKeyFile /etc/apache2/ssl/key/vhost1.key
    <Location />
            SSLRequireSSL On
            SSLVerifyClient optional
            SSLVerifyDepth 1
            SSLOptions +StdEnvVars +StrictRequire
    </Location>
</VirtualHost>
最佳回答

拆下管路:

WSGIDaemonProcess mydomain user=myuser group=mygroup processes=1 threads=1

来自443的VirtualHost。该VirtualHost中mydomain的WSGIProcessGroup能够访问80中的WSGIDaemonProcess定义。

换句话说,正如错误消息所建议的那样,WSGIDaemonProcess的名称,即mydomain,对于整个Apache服务器来说必须是唯一的。

如图所示,跨VirtualHosts引用意味着站点的HTTP和HTTPS变体仍将在同一守护进程组/解释器中运行。

问题回答

发帖希望它能帮助另一个人。。。

我遇到这个错误是因为一个虚拟主机文件在启用站点的目录中被符号链接了两次。





相关问题
ssl on login form?

I have SSL on my website....when the user logs in from a http page the form action is sent to https page, would this still secure the posted data? Or would it be better to have the form and the page ...

SSL slowness in EC2

We ve deployed our rails app to EC2. In our setup, we have two proxies on small instances behind round-robin DNS. These run nginx load balancers for a dynamically growing and shrinking farm of web ...

Why can t I find the truststore for an SSL handshake?

I m using the Spring RESTTemplate on the client side to make calls to a REST endpoint. The client in this case is a Spring app and Tomcat is the servlet container. I m running into issues making a ...

To add more parameter for my http header for SSL/TLS

As far as I understand, https is http plus SSL/TLS. What do I need to do if I want to add 3 more parameters for the header? I found a file inside Mozilla s NSS - ssl3ext.c, but I don t understand it ...

Why am I getting handshake_failure with Java SSL cert?

I m trying to use Hudson (which uses SVNKit) to access a Subversion repository that requires a client certificate to access it. I can access the same repository using the same client certificate via ...

热门标签