Home > other >  POST file upload request, Nginx report 405 errors
POST file upload request, Nginx report 405 errors

Time:10-05

The following is a nginx log:
175.171.184.77 - [15/Jul 2017:14:19:35 + 0800] "POST/newsedit/upload HTTP/1.1", 405 "http://www.xxx.com/newsedit/create" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3128.0 Safari/537.36 "

The following is the analysis process:
1, the code in the local Windows environment (not use nginx) run without exception, upload function to normal;
2, to deploy on a Linux server, use the nginx, upload function to 405 error;
3, in the same Linux server deployed on another set of applications also have a file upload function, can be used normally;
4, therefore, the analysis is nginx configuration problems;

Here are two sets of the same Linux server application nginx configuration:
1, upload function:
 
Server {
Listen, 80;
Server_name xxx.com xxx.net yyy.com yyy.net;

Access_log logs/portal. Access. The log;

The location/{
The root HTML;
index index.html index.htm;
Proxy_pass http://www.xxx.com:8300;
}
The location/portal {
The root HTML;
index index.html index.htm;
Proxy_pass http://www.xxx.com:8300;
}
The location/privacy. HTML {
The root HTML;
Proxy_pass http://asset.xxx.com:9001/privacy.html;
}

Error_page 504/50, 500, 502, 503 x. HTML;
Location=/50 x) HTML {
The root HTML;
}


2, and upload function to normal:
 
Server {
Listen, 80;
Server_name m.xxx.com m.xxx.net m.yyy.com m.yyy.net;

Access_log logs/maintenance. Access. The log;

The location/{
The root HTML;
index index.html index.htm;
Proxy_pass http://m.xxx.com:9300;
Proxy_redirect default;
}

The location ^ ~/eplus/ws/server {
Proxy_pass http://m.xxx.com:9300;

Proxy_set_header X - Real - IP $remote_addr;
Proxy_set_header Host $Host;
Proxy_set_header X - Forwarded - For $proxy_add_x_forwarded_for;

Proxy_http_version 1.1;
Proxy_set_header Upgrade $http_upgrade;
Proxy_set_header Connection "upgrade".
}

Error_page 504/50, 500, 502, 503 x. HTML;
Location=/50 x) HTML {
The root HTML;
}
}
  • Related