Can't see the location page in nginx.



  • Nginx:

    server {
         listen 8080 default_server;
         listen [::]:8080 default_server ipv6only=on;
    
     root /var/www/localpikabu.com/html;
     index index.html;
    
     server_name localpikabu.com www.localpikabu.com;
    
     location /hi 
     {
         index hi.html
     }
    

    }

    Here. localpikabu.com:8080 It works. When I change, localpikabu.com:8080/hi404.

    hi.html lies in the same folder as it is. index.html♪ What's wrong?



  • If your design is to work, you must:

    • or create a catalogue hi and move the file there hi.html
    • or add location directive alias approximately:

      location /hi {
        alias /var/www/localpikabu.com/html;
        index hi.html;
      }
      
    • or use the directive try_files approximately:

      location /hi {
        try_files $uri.html =404;
      }
      

Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2