ICode9

精准搜索请尝试: 精确搜索
首页 > 系统相关> 文章详细

解决vue打包后部署到线上nginx后刷新页面会404的问题

2022-05-14 13:04:29  阅读:50  来源: 互联网

标签:Control vue header 到线 Access nginx add set proxy


RT,主要还是nginx配置文件的问题,特此上一个较全的配置信息供大家参考:

server
{
    listen 80;
    server_name www.xxx.com;
    location / {
        root /home/www/box_admin_html;
        index index.html index.htm;
        try_files $uri $uri/ /index.html;
        proxy_next_upstream http_500 http_502 http_504 error timeout;
        add_header 'Access-Control-Allow-Origin' '*';
        add_header 'Access-Control-Allow-Credentials' 'true';
        add_header 'Access-Control-Allow-Methods' 'GET,POST,PUT,OPTIONS,DELETE';
        add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
    access_log /home/wwwlogs/access.log;

}

标签:Control,vue,header,到线,Access,nginx,add,set,proxy
来源: https://www.cnblogs.com/cx850116/p/16269669.html

专注分享技术,共同学习,共同进步。侵权联系[admin#icode9.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有