![设置 react fronted + node express 作为后端 - 405](https://linux22.com/image/764513/%E8%AE%BE%E7%BD%AE%20react%20fronted%20%2B%20node%20express%20%E4%BD%9C%E4%B8%BA%E5%90%8E%E7%AB%AF%20-%20405.png)
我的项目结构为
/var/www/html/server.js - express node api
/var/www/html/client/build/ - react npm run build
/var/www/html/client/package.json and other files
我的 nginx 配置
server {
server_name myEC2ip;
location / {
root /var/www/html/client/build/;
try_files $uri /index.html;
}
location /var/www/html/ {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_http_version 1.1;
proxy_pass http://myEc2IP:5000;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
我收到 405 错误 - 哪里出了问题?