Skip to content

history 路由造成 404 的原因

server {
  listen  80;
  server_name localhost;

  location / {
    root html;
    index index.html index.htm

    // 添加内容
    // 尝试读取$uri(当前请求的路径),如果不读取$uri/这个文件夹下的首页
    // 如果取不到就返回根目录中的index.html
    try_files $uri $uri/ /index.html;
  }
}

常见的重启方式

service nginx start

service nginx restart

service nginx stop

service nginx  reload