springboot+tomcat+vue+nginx 前后端分离配置

location / {
            root   /www/server/tomcat8/webapps/eduadmin;
            index  index.html index.htm;
            try_files $uri $uri/ /index.html;#解决登录之后刷新404
    }
    
    location /api {
        proxy_pass http://localhost:8000/education;#前端能够访问到后端
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Port $server_port;
        # 解决session共享问题   同步/education 和 /api
        proxy_cookie_path /education /api; 
        #    root   html;
        #    index  index.html index.htm;
    }

 

posted @ 2021-07-15 22:35  MvloveYouForever  阅读(123)  评论(0编辑  收藏  举报