Static files not requested


#1

Hi,

I have a multi docker contained architecture set up to run Omeka. I have Omeka running in a contained with php and apache2 on. I have a separate mysql container and a separate nginx container.

When I connect directly to the omeka container everything works correctly.

When I connect to the omeka contained through the nginx container it can’t find the static files. The problem appears to be that in nginx I am proxying to omeka only when I have a directory in the url. The nginx redirect looks like this:

        location /sw/ {
            proxy_set_header X-Real-IP  $remote_addr;
            proxy_set_header X-Forwarded-For $remote_addr;
            proxy_set_header Host $host;
            proxy_pass http://omeka/;
        }

The PHP files are served correctly, but static files are lost - I believe this is because omeka does not know it needs to add the directory to all the file requests (e.g. instead of http://mysite/style.css it should be http://mysite/sw/style.css).

Is there any way to set a subfolder in all static file (i.e. js, css, jpeg, etc) requests?


#2

I’m not super familiar with nginx configuration, but the issue here is that you’re having users from the outside request a different path than what you’re sending to Omeka: that’s going to affect more than just the static file requests but probably any links/URLs of any kind.

I seem to remember that nginx might preserve the original path if you omit the trailing slash you have on your proxy_pass directive? (But then your actual server serving Omeka would need to be set up to serve requests for /sw/).

One very simple option is just to move the Omeka installation under that same path, so the paths are the same between the proxy server and the “real” one.