将数据保存到数据库时弹出 502 bad gateway 错误。
用户登录 django 应用程序 (OLE 7) 后。从 ldap 服务器提取有关该用户的数据并将其保存在我的本地数据库(postgres)中。配置 nginx 后,它在本地服务器上运行得很好,gunicorn 一旦用户登录网站,而不是显示检索到的数据,它会显示 502 Bad gateway。我浏览了很多关于此问题的 stackoverflow 帖子,有些人说增加超时,检查 Gunicorn 是否正在运行。我已经尝试过这一切,但仍然行不通。
nginx.conf
user nginx;
worker_processes 2;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
er nginx;
worker_processes 2;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout …Run Code Online (Sandbox Code Playgroud)