Question

nginx How to add a simple path to folder

  • Posted October 31, 2014

I wish to add a simple folder off the root of my domain called resume. my root looks like this

location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header HOST $http_host;
        proxy_set_header X-NginX-Proxy true;
        root /opt/cornerpinsRoot;
        index index.html index.htm;
    }

it works fine, but adding this

location /resume/ {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header HOST $http_host;
        proxy_set_header X-NginX-Proxy true;
        root /opt/resume;
        index index.html index.htm PaulStocks.html;
    }

I get 404 not found errors from nginx.

The folders all have the correct/same permissions and nginx -t and -s reload say I’m fine. Both cornerpins.com/resume/index.html and cornerpins.com/resume fail.

What am I missing to get http://cornerpins.com/resume to work?

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

figured it out … leave off the folder root /opt