到目前为止,我在Ubuntu18.04远程服务器上使用uwsgi和nginx运行了一个Flask应用程序。这个应用程序是由我的网站监听端口5002的子域服务的。我想添加一个新的Flask应用程序来监听端口5003,但我一定是做了一些错误的配置,然后一切都失控了。现在这两个应用程序都不起作用了。
app1的服务器块
server {
client_header_buffer_size 64k;
large_client_header_buffers 4 64k;
client_max_body_size 75M;
server_name app.website1.eu;
location / {
include uwsgi_params;
proxy_ignore_client_abort on;
uwsgi_ignore_client_abort on;
client_body_buffer_size 64K;
client_max_body_size 8M;
uwsgi_pass 127.0.0.1:5002;
#uwsgi_pass unix:///home/pathto/website1.sock;
uwsgi_buffer_size 64k;
uwsgi_buffers 8 64k;
uwsgi_busy_buffers_size 64k;
uwsgi_read_timeout 300;
uwsgi_send_timeout 300;
uwsgi_connect_timeout 60;
}
listen 443 ssl; # managed by Certbot
listen [::]:443 ssl;
ssl_certificate /etc/letsencrypt/live/app.website1.eu/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/app.website1.eu/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = app.website1.eu) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
listen [::]:80;
server_name app.website1.eu;
return 404; # managed by Certbot
}
server {
client_header_buffer_size 64k;
large_client_header_buffers 4 64k;
client_max_body_size 75M;
server_name app.website2.eu;
location / {
include uwsgi_params;
proxy_ignore_client_abort on;
uwsgi_ignore_client_abort on;
client_body_buffer_size 64K;
client_max_body_size 8M;
uwsgi_pass 127.0.0.1:5003;
#uwsgi_pass unix:///home/pathto/website2.sock;
uwsgi_buffer_size 64k;
uwsgi_buffers 8 64k;
uwsgi_busy_buffers_size 64k;
uwsgi_read_timeout 300;
uwsgi_send_timeout 300;
uwsgi_connect_timeout 60;
}
listen 443 ssl; # managed by Certbot
listen [::]:443 ssl;
ssl_certificate /etc/letsencrypt/live/app.website2.eu/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/app.website2.eu/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = app.website2.eu) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
listen [::]:80;
server_name app.website2.eu;
return 404; # managed by Certbot
}
[uwsgi]
module = wsgi:app
master = true
processes = 10
enable-threads = true
uid=ilias
gid=www-data
socket=127.0.0.1:5002
#socket = website1.sock
chmod-socket = 666
vacuum = true
buffer-size=65536
harakiri=60
ignore-sigpipe=true
ignore-write-errors=true
disable-write-exception
post-buffering=1
logger=file:/home/path1/website1/uwsgierror.log
http-keepalive=3000
die-on-term = true
[uwsgi]
module = wsgi:app
master = true
processes = 10
enable-threads = true
uid=ilias
gid=www-data
socket=127.0.0.1:5003
#socket = website2.sock
chmod-socket = 666
vacuum = true
buffer-size=65536
harakiri=60
ignore-sigpipe=true
ignore-write-errors=true
disable-write-exception
post-buffering=1
logger=file:/home/path1/website2/uwsgierror.log
http-keepalive=3000
die-on-term = true
一如既往,这是一个文件夹权利问题。如果您在创建文件夹和创建虚拟环境的步骤中严格遵循教程,那么一切都很顺利。
Supported tags and respective Dockerfile links python3.9, latest (Dockerfile) python3.8, (Dockerfile) python3.7, (Dockerfile) python3.6 (Dockerfile) Discouraged tags python3.8-alpine (Dockerfile) To l
问题内容: 我在烧瓶上创建了一个端点,该端点从数据库查询(远程数据库)生成电子表格,然后将其作为下载内容发送到浏览器中。Flask不会抛出任何错误。Uwsgi没有抱怨。 但是当我检查nginx的error.log时,我看到了很多 2014/12/10 05:06:24 [错误] 14084#0:* 239436上游过早关闭连接,同时从上游读取响应头,客户端:34.34.34.34,服务器:me.c
在前面的章节中我们使用 python manage.py runserver 来运行服务器。这只适用测试环境中使用。 正式发布的服务,我们需要一个可以稳定而持续的服务器,比如apache, Nginx, lighttpd等,本文将以 Nginx 为例。 安装基础开发包 Centos 下安装步骤如下: yum groupinstall "Development tools" yum install
我的应用程序有以下堆栈: Nginx(1.4.6) UWSGI(1.9.17.1-Debian(64bit)) 烧瓶 Python 3.4 NGINX重启后的问题在一段时间内(几分钟)都能正常工作。在此期间之后,我收到一个“504网关超时”错误。 NGINX日志: *13从上游读取响应标头时上游超时(110:连接超时),客户端:86.123.39.44,服务器:app.fc.com,请求:“get
我正试图在Docker上用Nginx、uWSGI和Postgres安装一个Django应用程序。我找到了一本关于为Django和Postgres设置Compose的优秀指南:https://docs.docker.com/v1.5/compose/django/ 但是,现在我需要添加Nginx和uWSGI。我试过使用这个回购协议的文件(https://github.com/baxeico/djan
当我使用 Flask 结合 uWSGI 在服务器上以 HTTP 模式启动部署时,如果我通过科学上网访问服务器的公网 IP 加上端口,我可能会遇到网络阻断和高延迟的问题,导致无法正常访问。然而,当我关闭科学上网并使用服务器的真实 IP 地址时,访问就正常了。另外一种解决方法是使用 Nginx 反向代理端口,这样就不会受到科学上网的影响。不清楚这种方法的原理是什么。