使用WSGI的Apache2上的SSL
我正在尝试在我维护的Django站点上设置SSL,并使用SSL设置我的VirtualHost时遇到了一些问题。 我按照这里的说明,但每次我尝试重新启动Apache,它告诉我,它不能重新启动,因为多个虚拟主机使用相同的wsgiconfiguration:
/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!
我明白发生了什么,而不是如何解决这个问题。 任何build议表示赞赏,谢谢! 这是我的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。用于该虚拟主机中的mydomain的WSGIProcessGroup能够到达80中的WSGIDaemonProcess定义。
换句话说,正如错误消息试图build议的那样,对于整个Apache服务器来说,WSGIDaemonProcess(即“mydomain”)的名称必须是唯一的。
如所指示的那样跨虚拟主机引用意味着站点的HTTP和HTTPS变体将仍然在相同的守护进程组/解释器中运行。
张贴希望这将有助于另一个…
我遇到了这个错误,因为虚拟主机文件已经在启用了站点的目录中被两次符号链接。