Using morbo, the static files are rendered for all pages. However with the hypnotoad server using Nginx as a proxy, a page is loaded but static files within are not rendered – not even the favicon, but calling a static html page within the same app, both images and favicon appear. What maybe missing?
upstream backendurl {
server 127.0.0.1:8080 fail_timeout=0;
}
server {
listen 80;
listen [::]:80;
server_name example.com www.example.com ;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log info;
root /var/www/example.com/public;
location / {
try_files $uri @proxy;
access_log off;
expires max;
add_header 'Access-Control-Allow-Origin' 'http://example.com';
}
location @proxy {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://backendurl;
}
}
The Apache2 solution gave some hints: https://github.com/mojolicious/mojo/wiki/Apache-deployment
A successful Nginx solution was found as follows: