Typically, I want to serve an index.html file when http://mysite.com/
and any other directory is requested. The following, in nginx.conf, does that for /test
:
location /test {
try_files $uri.html $uri/index.html /index.html =404;
}
If I want to serve files from that same location through cgi (on thttpd), this also works as it should, serving up a cgi programmed page:
location /test {
proxy_pass http://127.0.0.1:8000;
}
The problem I have is figuring out how to go to a deeper level, such as /test/page1. If page1.html exists, I want that served but, if not, I want it to go to the thttpd server and run the cgi program there. The many variations in the config file I've tried either give me a redirect loop or file not found or an error from the server. Other times, I can get it to serve the cgi and html files but trying to access the directory gives a loop.
The following also worked, in part, but I'm so burned out trying different variations, I've gotten myself lost.
location /test {
proxy_pass http://127.0.0.1:8000/test;
}
I'm sure there is just one simple, fundamental thing I'm missing.