Preston
Preston

Reputation: 75

Nginx 404 not found for mysite.com/page/0.html

I'm trying to get Nginx to allow me to cycle through pages in auger.sudogami.com/pages/0..1.2.3. ect but it's giving my 404 not found for them. It loads the main page, auger.sudogami.com just fine though.

My index file is actually named 0.html located in the page directory, just as a heads up. I was tinkering with try_files but couldn't get it to work at all.

server {

        root /var/www/auger.sudogami/;

        # Add index.php to the list if you are using PHP
        index page/0.html page/0.htm index.nginx-debian.html;

        server_name auger.sudogami.com www.auger.sudogami.com;

        location / {

                try_files $uri $uri/ page/0.html?$args;
           
        }

Upvotes: 0

Views: 33

Answers (1)

Preston
Preston

Reputation: 75

This is what I ended up doing, it does what I need it to at least. I redirected the main location to the page directory.

location / {
                return 301 /page/0.html;
                autoindex on;

        }

and added this other block.

location /page/ {
        index 0.html
        autoindex on;
        }

Upvotes: 1

Related Questions