我有 Nginx 和两个带有 uwsgi 的 python 虚拟环境。这些环境分别用于开发和生产。我想要在 :80 端口上运行生产环境,在 :6544 端口上运行开发环境
这是我的配置
server {
listen 80;
access_log off;
error_log /var/log/nginx/http.prod.error.log;
charset utf-8;
location / {
uwsgi_pass unix:///tmp/uwsgi.sock;
include uwsgi_params;
}
}
server {
listen 6544;
access_log off;
error_log /var/log/nginx/http.dev.error.log;
charset utf-8;
location / {
uwsgi_pass unix:///tmp/uwsgi.sock;
include uwsgi_params;
}
}
当我这样做时,%production%/bin/uwsgi --ini-paste-logged %production%/production.ini
它运行良好。但是当我尝试启动开发版本时,%dev%/bin/uwsgi --ini-paste-logged %dev%/dev.ini
我在 uwsgi.log 中得到了以下内容:
*** Starting uWSGI 1.9.12 (64bit) on [Fri Jun 7 07:35:21 2013] ***
compiled with version: 4.4.3 on 07 June 2013 07:32:32
os: Linux-2.6.32-38-server #83-Ubuntu SMP Wed Jan 4 11:26:59 UTC 2012
nodename: pt-apps2
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 24
current working directory: /home/dev
writing pidfile to ./pid_5000.pid
detected binary path: /home/dev/bin/uwsgi
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
unlink(): Operation not permitted [core/socket.c line 135]
bind(): Address already in use [core/socket.c line 185]
*** Starting uWSGI 1.9.12 (64bit) on [Fri Jun 7 07:38:24 2013] ***
compiled with version: 4.4.3 on 07 June 2013 07:32:32
os: Linux-2.6.32-38-server #83-Ubuntu SMP Wed Jan 4 11:26:59 UTC 2012
nodename: pt-apps2
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 24
current working directory: /home/dev
writing pidfile to ./pid_5000.pid
detected binary path: /home/dev/bin/uwsgi
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
unlink(): Operation not permitted [core/socket.c line 135]
bind(): Address already in use [core/socket.c line 185]
dev.ini 包含以下设置:
[uwsgi]
socket = /tmp/uwsgi.sock
master = true
processes = 4
harakiri = 60
harakiri-verbose = true
limit-post = 65536
post-buffering = 8192
daemonize = ./uwsgi.log
pidfile = ./pid_5000.pid
listen = 256
max-requests = 1000
reload-on-as = 128
reload-on-rss = 96
no-orphans = true
log-slow = true
我相信我的配置出了点问题,但我不知道哪里出了问题。另一个有趣的事情是,当生产 UWSGI 运行时,我可以访问 :6544,但我看不到开发版本,只有生产版本。所以我认为 80 和 6544 端口仅用于生产。有什么想法可以按端口拆分一个应用程序的两个版本吗?
谢谢
答案1
您正在尝试对开发和生产使用相同的 Unix 域套接字。请为它们使用不同的套接字。