我有这个default.conf:
server {
listen 443 ssl;
root /etc/nginx/json/;
server_name myserver.com;
ssl_certificate /etc/ssl/certs/server.crt;
ssl_certificate_key /etc/ssl/private/server.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
location /platform/enabler/iam/token/generate/1.0.0
{
alias /etc/nginx/json/generateToken.json;
} }
使用GET方法调用API,响应正确。 使用POST方法调用API的响应是:
<html>
<head><title>405 Not Allowed</title></head>
<body bgcolor="white">
<center><h1>405 Not Allowed</h1></center>
<hr><center>nginx/1.14.2</center>
</body>
</html>
请,你能帮我吗?
答案 0 :(得分:0)
您可以将以下行添加到配置中,以使nginx使用静态文件处理POST请求:
error_page 405 =200 $uri;