无法连接到WSGI守护程序进程' sampleapp'

时间:2016-01-16 18:37:49

标签: django ubuntu apache2

我尝试在ubuntu服务器上安装django,我在error.log中遇到503错误 我的apache2.conf是:

<VirtualHost x.xxx.xxx.xxx:8080>
ServerAlias www.samplesite.com
ServerAdmin info@samplesite.com
DocumentRoot /var/www/sampleapp/
ScriptAlias /cgi-bin/ /var/www/sampleapp/cgi-bin/
Alias /vstats/ /var/www/sampleapp/stats/
Alias /error/ /var/www/sampleapp/document_error
#SuexecUserGroup admin admin
CustomLog /var/log/apache2/domains/sampleapp.ir.bytes bytes
CustomLog /var/log/apache2/domains/sampleapp.ir.log combined
ErrorLog /var/log/apache2/domains/sampleapp.ir.error.log
WSGIProcessGroup sampleapp
WSGIScriptAlias /sampleapp /var/www/sampleapp/sampleapp/wsgi.py
WSGIDaemonProcess sampleapp python-path=/var/www/sampleapp:/var/www    /sampleapp/envme/lib/python3.4/site-packages
<Directory /var/www/sampleapp/static/>
Require all granted
</Directory>
<Directory /var/www/sampleapp/media/>
Require all granted
</Directory>
<Directory /var/www/sampleapp/sampleapp/>
<Files wsgi.py>
require all granted
</Files>
</Directory>

<Directory /var/www/sampleapp/>
AllowOverride All
    Options +Includes +Indexes +ExecCGI

   Order allow,deny
   Allow from all
</Directory>
</VirtualHost>

我在error.log中有这个错误:

(13)Permission denied: [client x.xxx.xx.xxx:59504] mod_wsgi (pid=26905): Unable to connect to WSGI daemon process 'sampleapp' on '/var/run/apache2/wsgi.26899.0.1.sock' as user with uid=1005.

我试图解决它失去了2天,

1 个答案:

答案 0 :(得分:3)

您可以参考此网址

http://code.google.com/p/modwsgi/wiki/ConfigurationIssues#Location_Of_UNIX_Sockets

添加此内容,

WSGISocketPrefix run/wsgi

将解决错误。解决方案是将套接字文件保存到Apache用户可以读取的位置。