在上网后我发现了这些:
nginx upload client_max_body_size issue
https://www.scalescale.com/tips/nginx/502-bad-gateway-error-using-nginx/#
user www-data;
worker_processes auto;
pid /run/nginx.pid;
events {
worker_connections 768;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
client_body_temp_path /tmp/;
client_body_in_file_only on;
client_body_buffer_size 128K;
client_max_body_size 30M;
fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
gzip on;
gzip_disable "msie6";
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
./conf.d/default.conf
upstream app {
server localhost:8000;
}
server {
listen 80;
server_name jobs.siamsbrand.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;
server_name jobs.siamsbrand.com;
add_header Strict-Transport-Security "max-age=31536000";
proxy_pass_request_headers on;
root /www/data;
ssl_certificate /root/fullchain.pem;
ssl_certificate_key /root/privkey.pem;
include snippets/ssl-params.conf;
location / {
proxy_pass_request_headers on;
proxy_set_header Host $host;
proxy_pass http://app;
}
location /static {
try_files $uri $uri/ =404;
}
location /media {
try_files $uri $uri/ =404;
}
location ~ /.well-known {
allow all;
}
}
gunicorn:
gunicorn --bind 0.0.0.0:8000 --workers 3 --worker-class gevent wsgi:application --log-level=INFO
问题:
30秒后我得到了502
。
我哪里错了?