nginx 代理接口报404
查看日志:
cat logs/error.log
代理访问后端的代理接口,在日志中一直访问的是html页面路径:

最后的在这个帖子下,找到思路
https://blog.csdn.net/weixin_44928129/article/details/134512027
解决方法:
server {
listen 80;
server_name test.xxxxx.cn;# 这个服务器没有域名,不能写 localhost,127.0.0.1,要写当前服务器ip地址
location /api {
include proxy.conf;
proxy_pass http://127.0.0.1:8888;
}
}
server_name:不能写 localhost,要写当前服务器ip地址,
自己一脚踩进去的坑,爬半天起不来

浙公网安备 33010602011771号