Nginx directly input url to access pure html page, report error 404 Not Found, or main page (index) refresh error

it seems that apache will do the same.

clipboard.png

nginxserver
clipboard.png

linux


clipboard.png

personal website, there is no problem with index page refresh, but entering other page refresh will be gg.
http://leisuremoment.com/

Mar.04,2021

first check whether index.html exists in the web root directory, and then check the conf.d of nginx

-sharp 
root    /var/www/html;
location / {
    -sharp 
    index  index.html index.htm;
}

try_files is not written in the configuration, is it?

< hr >

Update

look at the configuration and talk about some problems found:

  1. rewrite ^ / (. *) http://www.leisuremoment.com/$1 permanent; and try_files do not use together. The latter is to solve (optimize) the former, so that we can use it together.
  2. with regard to try_files / var/www/html/index.html; , the root directory has been located with root before, but what comes out is actually based on the root directory, so it would be wrong to enter more sets of complete paths.
  3. try_files Let's write try_files $uri $uri/ / index.html; first
  4. .
  5. this paragraph:

      

    you post your nginx configuration information, and then release the url you visit, and you can figure out what the problem is

    .
Menu