ini HTML5模式下Vue-Router的NGiNX配置

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ini HTML5模式下Vue-Router的NGiNX配置相关的知识,希望对你有一定的参考价值。

server {
  listen 80 default_server;
  listen [::]:80 default_server;

  root /your/root/path;

  index index.html;

  server_name you.server.com;

  location / {
    try_files $uri $uri/ @rewrites;
  }

  location @rewrites {
    rewrite ^(.+)$ /index.html last;
  }

  location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
    # Some basic cache-control for static files to be sent to the browser
    expires max;
    add_header Pragma public;
    add_header Cache-Control "public, must-revalidate, proxy-revalidate";
  }

}

ini HTML5模式下Vue-Router的NGiNX配置

server {
  listen 80 default_server;
  listen [::]:80 default_server;

  root /your/root/path;

  index index.html;

  server_name you.server.com;

  location / {
    try_files $uri $uri/ @rewrites;
  }

  location @rewrites {
    rewrite ^(.+)$ /index.html last;
  }

  location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
    # Some basic cache-control for static files to be sent to the browser
    expires max;
    add_header Pragma public;
    add_header Cache-Control "public, must-revalidate, proxy-revalidate";
  }

}

以上是关于ini HTML5模式下Vue-Router的NGiNX配置的主要内容,如果未能解决你的问题,请参考以下文章

ini HTML5模式下Vue-Router的NGiNX配置

ini HTML5模式下Vue-Router的NGiNX配置

vue-router-基础

vue-router-基础

vue-router(妙味课堂)

vue-router在ie9及以下history模式支持