I am new to configuring Nginx servers and I've been bashing my head against a wall for a few days now. I know it's been asked a lot and even though I've read all the answers, the Nginx documentation and whatever else I could find out there I couldn't get to the bottom of this.
server {
listen 80;
root /var/www/gofive;
index index.html indx.htm;
server_name gofive.justadev.com localhost 127.0.0.1;
location /webhooks/ {
root /var/www/webhooks;
}
}
My intention is is to serve content from a different directory when requests are made to /webhooks/. I've tried many variations of this configuration file but every request I make to /webhooks/ is a 404. Am I doing something wrong? I've also granted 755 permission to everything under /var/www and restarted the Nginx service after each configuration change.
I am running Nginx on an Ubuntu 14.04 LTS distro.
The /var/www/webhooks dir contains just a simple index.html file. After checking the error logs, I found this error:
2015/10/23 20:06:33 [error] 24723#0: *1 "/var/www/webhooks/webhooks/index.html" is not found (2: No such file or directory), client: [my_ip], server: gofive.justadev.com, request: "GET /webhooks/ HTTP/1.1", host: "gofive.justadev.com"
Apparently it repeats the /webhooks/ part on the file system. Why is this happening?