我用的是vue+springboot的前后端分离项目,前端用nginx部署,后端直接打包成jar包运行。
我在服务器主机上运行是没有任何问题的,但是在局域网下其它电脑访问就出现问题了,其它电脑可以访问前端,但是向后端发送的请求都失败了。
这是我nginx的配置文件:
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html/dist;
index index.html index.htm;
}
location /manage {
proxy_pass http://localhost:8089;
proxy_connect_timeout 3;
proxy_send_timeout 30;
proxy_read_timeout 30;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 100m;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
这是其它电脑报错的图片: