location problem with static content

Philipp Kraus philipp.kraus at tu-clausthal.de
Tue Oct 29 18:34:15 UTC 2013


I have created for my GitLab installation this entries in the configuration:

    location /gitlab {
        root /home/gitlab/gitlab/public;
        try_files $uri $uri/index.html $uri.html @gitlab;

    location @gitlab {
        proxy_read_timeout      300;
        proxy_connect_timeout   300;
        proxy_redirect          off;
        proxy_set_header        X-Forwarded-Proto $scheme;
        proxy_set_header        Host $http_host;
        proxy_set_header        X-Real-IP $remote_addr;

        proxy_pass             http://localhost:9080;

so I can use GitLab with https://myserver/gitlab, most functions of GitLab works well, but I have got a problem with the static content.
I get this error:

[error] 4573#0: *4 open() "/home/www/static.css" failed (2: No such file or directory)

The message is correct, because the main root dir (above the location) is set to /home/www, so the fallback mechanism works.
But in my case I need a correct rule, that also static content, which have got the /gitlab URL part are mapped into /home/gitlab/gitlab/public

How can I tell my location rule, that static content is stored in the correct root folder?


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 163 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20131029/3645cff4/attachment.bin>

More information about the nginx mailing list