简体   繁体   中英

Nginx any uri to root directory

How can I make any request to Nginx server be served from fixed static page ("/html/index.html")?

For example: I want following requests to be served from /html/index.html localhost/ localhost/data localhost/data/html localhost/data/images

Nginx by default appending the URI to my root directory and is looking for it in local file system.

root /html;

location / {
  try_files /index.html =404;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM