I will not lecture you about 'asking questions: the right way', but if you really want an answer - send more information, please. Now to the business. One of my systems have exactly such setup - hypnotoad serving application on localhost:3000, nginx doing reverse proxy. I don't see where is you're problem could be, I will post my configs so you can find the answer yourself just by comparison of yours and mine configs.
Application is located in /usr/local/x/ports/portmgr, so there is /usr/local/x/ports/portmgr/public dir for static files. There is also /usr/local/www/mgmt dir for other static files.
Nginx:
server {
listen 80;
server_name mgmt.site.local;
location / {
try_files $uri @proxy;
root /usr/local/www/mgmt;
add_header 'Access-Control-Allow-Origin' 'http://some.site.local';
}
location @proxy {
auth_basic "RTK MGMT Site";
auth_basic_user_file /usr/local/x/snmp/passwd;
proxy_pass http://localhost:3000;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
With such config when someone request http://mgmt.site.local/image.png, 1) nginx search /usr/local/www/mgmt for image.png, if not found, 2) request goes to http://localhost:3000, 3) hypnotoad look in /usr/local/x/ports/portmgr/public (and other static paths, which you can add in script) for static file image.png, if it's not found, 4) hypnotoad search routes for /image.png, if no route found, then 404 error displayed.
I would also suggest you to point your nginx root to your application public dir, so static files could be served by nginx, not Mojolicious, thus they will be served much faster.
UPDATE: sorry, i've checked (and corrected post) - hypnotoad first look for static file, then look in routes. |