• nginx retryfiles


    # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;
    
        #根据路由设置,避免出现404
        location ^~ /api/ {
                add_header 'Access-Control-Allow-Origin' '*';
                proxy_pass http://service.xxxx.com/;
        }
        location / {
            try_files $uri $uri/ @router;#需要指向下面的@router否则会出现vue的路由在nginx中刷新出现404
            index  index.html index.htm;
        }
        #对应上面的@router,主要原因是路由的路径资源并不是一个真实的路径,所以无法找到具体的文件
        #因此需要rewrite到index.html中,然后交给路由在处理请求资源
        location @router {
            rewrite ^.*$ /index.html last;
        }
        error_page 404 /404.html;
            location = /40x.html {
        }
    
        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
    }
  • 相关阅读:
    20151104内置对象
    20151102adonet2
    20151029adonet1
    20151028c#4
    20151027c#3
    20151026c#2
    20151021c#1
    20151020sql2
    20151019sql1
    Codeforces Round #261 (Div. 2) C. Pashmak and Buses(思维+构造)
  • 原文地址:https://www.cnblogs.com/gaoyuechen/p/11578176.html
Copyright © 2020-2023  润新知