302 error

Symptom: A browser returns a 302 error when nginx uses a non-80 port as a reverse proxy

Solution:

// if proxy_set_header Host $Host; Proxy_set_header Host $Host :$server_POST; // proxy_set_header Host $Host :$server_POST; {proxy_set_header Host $Host :$server_post; Proxy_pass http://127.0.0.1; }Copy the code

400 error

Nginx400 errors are caused by the request header being too large, usually by writing a long string to a cookie. If the cookie is too large, large_client_header_buffers may also need to be adjusted (default 4k)

403 error

Refer to (403 Error Resolution)[rumenz.com/rumenbiji/n…]

413 error

413 Request Entity Too Large
Copy the code

This problem occurs when uploading files, and some data is passed in sizes larger than nginx’s configuration

Solution:

hhtp{ client_max_body_size 8M; // Change the value client_body_buffer_size 128K; Ini post_max_size = 8M upload_max_filesize = 6M Restart the PHP service. If the back-end is Springboot, Spring Boot 1.3.x Multipart. MaxFileSize = 8 m multipart maxRequestSize = 8 m Spring Boot 1.4 x and 1.5 x. Spring. HTTP multipart. MaxFileSize = 8 m spring.http.multipart.maxRequestSize=8M Spring Boot 2.x spring.servlet.multipart.max-file-size=8M spring.servlet.multipart.max-request-size=8MCopy the code

414 error

414 Request-URI Too Large The REQUESTED URL is Too long

Solution:

http{
    client_header_buffer_size 512k;
    large_client_header_buffers 4 512k;
}
Copy the code

499 error

This is a status code defined by Nginx to indicate an error in which the client closes the HTTP connection before the server returns the HTTP header

The core of the problem is to ask why the server processing time is too long

Possible problems:

1. The background Python program takes too long to process requests

2. The mysql slow queries

By viewing the monitoring:

1. The CPU and memory usage are within the normal range

2. The background program is properly accessed

MySQL has no slow query

502 error

502 Bad Gateway: An invalid response is received from the upstream server when the server working as a Gateway or proxy tries to execute the request

504 error

504 Gateway time-out: When the Gateway or proxy server tries to execute a request, it fails to receive a response from the upstream server (a server identified by the URI, such as HTTP, FTP, or LDAP) or a secondary server (such as DNS) in a timely manner.