我遇到了一个问题,不知道如何在nginx中启用CORS。老实说,我找到了很多在nginx中启用CORS的解决方案,其中之一是https://enable-cors.org/server_nginx.html,但我已经将这些代码添加到我的
请告诉我如何修复它。谢谢。
/etc/nginx/nginx.conf
并重新启动了nginx
服务器。但我在postman中再次尝试时,nginx引发了以下错误。<html>
<head>
<title>405 Not Allowed</title>
</head>
<body bgcolor="white">
<center>
<h1>405 Not Allowed</h1>
</center>
<hr>
<center>nginx/1.12.1</center>
</body>
</html>
请告诉我如何修复它。谢谢。
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name localhost;
root /var/www/test/app/;
# Load configuration files for the default server block.
include /etc/nginx/default/*.conf;
add_header 'Access-Control-Allow-Origin' *;
add_header 'Access-Control-Allow-Methods' 'GET, POST';
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
location / {
}
http://sanmel.wave.money/#/callback
。 - PPShein