Home > Software design >  NGINX simple proxy doesnt work, get 404 on location
NGINX simple proxy doesnt work, get 404 on location

Time:10-26

I am trying to learn nginx and this simple test gives me 404 when going to localhost:81/test. I basically want the same index page to show up on /test.

I'm using nginx from windows on my local computer. Downloaded from http://nginx.org/en/docs/windows.html and starts by running ./nginx.exe in bash-terminal

tldr: localhost:81 gives me the indexpage and localhost:81/test gives me 404

my nginx.conf:

worker_processes  1;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;


    server {
        listen 81 ;
        server_name localhost;

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

CodePudding user response:

Had to replace root html with alias html in the location /test-block

  • Related