uWSGI虚拟主机问题
uWSGI 配置
[uwsgi]
socket = /tmp/uwsgi.sock
chmod-socket = 666
processes = 1
master = true
vhost = true
no-site = true
Nginx 配置
server {
listen 80;
server_name www.site1.com;
location / {
include uwsgi_params;
uwsgi_pass unix:/tmp/uwsgi.sock;
uwsgi_param UWSGI_PYHOME /var/virtualenvs/site1;
uwsgi_param UWSGI_CHDIR /var/www/site1;
uwsgi_param UWSGI_SCRIPT wsgi;
}
}
server {
listen 80;
server_name www.site2.com;
location / {
include uwsgi_params;
uwsgi_pass unix:/tmp/uwsgi.sock;
uwsgi_param UWSGI_PYHOME /var/virtualenvs/site2;
uwsgi_param UWSGI_CHDIR /var/www/site2;
uwsgi_param UWSGI_SCRIPT wsgi;
}
}
无论我第一个访问的站点是什么,它都会卡住显示,所以如果我先转到 site2,我就看不到 site1。关于为什么 uWSGI vhost 设置似乎不起作用的任何想法?
uWSGI config
[uwsgi]
socket = /tmp/uwsgi.sock
chmod-socket = 666
processes = 1
master = true
vhost = true
no-site = true
Nginx config
server {
listen 80;
server_name www.site1.com;
location / {
include uwsgi_params;
uwsgi_pass unix:/tmp/uwsgi.sock;
uwsgi_param UWSGI_PYHOME /var/virtualenvs/site1;
uwsgi_param UWSGI_CHDIR /var/www/site1;
uwsgi_param UWSGI_SCRIPT wsgi;
}
}
server {
listen 80;
server_name www.site2.com;
location / {
include uwsgi_params;
uwsgi_pass unix:/tmp/uwsgi.sock;
uwsgi_param UWSGI_PYHOME /var/virtualenvs/site2;
uwsgi_param UWSGI_CHDIR /var/www/site2;
uwsgi_param UWSGI_SCRIPT wsgi;
}
}
Whatever site I hit first is the one it is stuck displaying, so if I goto site2 first I can't ever see site1. Any thoughts on why the uWSGI vhost setting seems not to be workin?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
最终的问题是使用 INI 配置文件会导致 uWSGI 在单解释器模式下运行。 XML 中完全相同的配置允许一切正常工作。 uWSGI 开发人员在未来的版本中不会出现这种情况。
The problem ending up being that using an INI config file results in uWSGI running in single interpreter mode. The exact same config in XML allows everything to work correctly. The uWSGI developer this would NOT be the case in future versions.
在这里 http://wiki.nginx.org/HttpUwsgiModuleMultipleDynamicApplications 您可以找到示例,如何通过单个上游设置多个uWSGI应用程序。
Here http://wiki.nginx.org/HttpUwsgiModuleMultipleDynamicApplications you can find example, how to setup multiple uWSGI apps, throuth a single upstream.
如果你想使用 TCP 连接或者 nginx 构建时没有 uwsgi_pass 支持:
nginx config:
uwsgi ini file:
If you want to use TCP connection or nginx is built witout uwsgi_pass support:
nginx config:
uwsgi ini file:
改用 TCP 套接字怎么样?
nginx 配置
How about use TCP socket instead?
nginx config