我正在使用Nginx和uwsgi设置ubuntu服务器.昨天跑步
sudo服务Nginx重启
和
sudo服务uwsgi重新启动
会生成此套接字:/run/uwsgi/app/recoapi/recoapi.socket
我使用pip而不是apt-get来安装uwsgi,从那时起,一直没有生成recoapi.socket文件.当我尝试卷曲服务器时,我在Nginx error.log中发现以下错误.
2013/09/01 13:59:12 [crit] 29712#0:* 1 connect()到unix:///run/uwsgi/app/recoapi/recoapi.socket失败(2:没有此类文件或目录)连接上游
<html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
<hr><center>Nginx/1.2.6 (Ubuntu)</center>
</body>
</html>
我的uwsgi配置文件如下所示.有关套接字权限的行似乎无效.
<uwsgi>
<plugin>python</plugin>
<uid>www-data</uid>
<gid>www-data</gid>
<chmod-socket>777</chmod-socket>
<chown-socket>www-data</chown-socket>
<socket>/run/uwsgi/app/recoapi/recoapi.socket</socket>
<pythonpath>/var/www/recoapi/application/</pythonpath>
<wsgi-file>/var/www/recoapi/application/wsgi_configuration_module.py</wsgi_file>
<app mountpoint="/">
<script>wsgi_configuration_module</script>
</app>
<processes>4</processes>
<harakiri>60</harakiri>
<reload-mercy>8</reload-mercy>
<cpu-affinity>1</cpu-affinity>
<stats>/tmp/stats.socket</stats>
<max-requests>2000</max-requests>
<limit-as>512</limit-as>
<reload-on-as>256</reload-on-as>
<reload-on-RSS>192</reload-on-RSS>
<no-orphans/>
<vacuum/>
</uwsgi>
我从this tutorial开始工作.
server {
listen 80;
server_name $hostname;
access_log /var/www/recoapi/logs/access.log;
error_log /var/www/recoapi/logs/error.log;
location / {
#uwsgi_pass 127.0.0.1:9001;
uwsgi_pass unix:///run/uwsgi/app/recoapi/recoapi.socket;
include uwsgi_params;
uwsgi_param UWSGI_SCHEME $scheme;
uwsgi_param SERVER_SOFTWARE Nginx/$Nginx_version;
}
location /static {
root /var/www/recoapi/public_html/static/;
}
}
最佳答案