I'm using NginX 1.4.6 on Windows, and there's a server block (the only server block) in my nginx.conf which is defined as below:
server {
listen 8000;
server_name localhost;
access_log logs/host.access.log main;
location / {
root D:\Git\SNHAutomationRuby\output\screenshots;
}
location ~* /img/.*$ {
root D:\Git\SNHAutomationRuby\output\screenshots;
}
}
I have some png screenshots in folder D:\Git\SNHAutomationRuby\output\screenshots
, and with this configuration, the image
D:\Git\SNHAutomationRuby\output\screenshots\20140313-08-35-02-108466000.png
can be successfully loaded in Firefox by accessing
http://localhost:8000/20140313-08-35-02-108466000.png
However, nginx retuened a 404 when I access
http://localhost:8000/img/20140313-08-35-02-108466000.png
I assume that there's something wrong in the location block
location ~* /img/.*$ {
root D:\Git\SNHAutomationRuby\output\screenshots;
}
Is the regular expression /img/.*$
incorrect so that it cannot match http://localhost:8000/img/20140313-08-35-02-108466000.png
? Or is there any other configuration I've done incorrectly?