http - serving two websites with nginx -


i want run simple nginx page serves 2 pages. 1 folder ~/a , 1 ~/b

each folder runs copy of python's simplehttpserver in ports 1000 , 2000

each file has single file called index.html text hello world!

server {              listen 80;         index index.html index.htm;          # make site accessible http://localhost/         server_name localhost;          location /   {                 root ~/a;                 proxy_pass http://localhost:1000;         }          location /b/ {                 root ~/b;                 proxy_pass http://localhost:2000;         }  } 

unfortunately curl http://localhost/b/index.html returns 404.

<head> <title>error response</title> </head> <body> <h1>error response</h1> <p>error code 404. <p>message: file not found. <p>error code explanation: 404 = nothing matches given uri. </body> 

what wrong nginx conf file? why can't route properly?

i think want use alias ~/b instead of root ~/b because location /b/ try ~/b/b. see alias , root documentations.


Comments