springboot +vue +linux服务器配置

搞了很久的配置,终于解决问题了qwq
开始是一直访问不到方法的问题,后面是刷新出现404问题

附上nginx.conf主要配置
server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
        	#vue打包后dist文件所在目录
            root   /root/dist;
            #路由转发,解决刷新404问题
            try_files $uri $uri/ /index.html;
            #默认找到的页面
            index  index.html index.htm;
        }
        #用于解决跨域的问题,有/api的路径就将访问路径换成后台的这个路径
        location /api{
             proxy_pass http://39.108.191.226:8080/uniform;
        }

后面重启nginx就可以了

你可能感兴趣的:(springboot +vue +linux服务器配置)