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

标签 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.

我花了两天时间试图解决它,

最佳答案

你可以引用这个网址,

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

加上这个,

WSGISocketPrefix run/wsgi

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

关于django - 无法连接到 WSGI 守护进程 'sampleapp',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34830662/

相关文章:

python - ManyToManyField 不保存在 django 中

python - 如何将自定义 Django 用户模型注册到管理页面?

database - PostgreSQL : 'psql: error: could not connect to server: No such file or directory' . s.PGSQL.5432

sql-server - 连接到 SQL Server(从 Ubuntu): [RubyODBC] Cannot allocate SQLHENV

linux - tar 命令更改所有者 :group while extracting

apache2 - fastCGI 进程之间如何共享数据?

django - 如何修复我的 Django 网站中的 "bool object is not callabe"错误

python - 如何在Python中对字符串元素的排序列表应用二分搜索?

tomcat - Apache/Tomcat 返回错误 503

python - Apache 和 Python 线程处理奇怪的结果