nginx configuration for upload file size and nodejs proxy

紀錄一下...

Upload file size configuration

$ more /etc/nginx/nginx.conf
# skip...
http {
    # skip...
    sendfile on;
    send_timeout 300s;
    client_body_in_file_only clean;
    client_body_buffer_size 32K;
    client_max_body_size 30M;
    # skip...
}
# skip...

 

nodejs proxy configuration

# supposed nodejs run on 3000 port
$ more /etc/nginx/conf.d/test.conf
upstream app_demo.com {
    server 127.0.0.1:3000;
}

server {
    # skip...
    location /app_demo/ {
        proxy_pass http://app_demo.com/;
        proxy_redirect off;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_cache_bypass $http_upgrade;
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
        proxy_set_header X-Real-IP $remote_addr ;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for ;
        proxy_set_header X-Forwarded-Proto https;
        proxy_set_header X-NginX-Proxy true;
    }
    # skip...
}
# skip...