location problem with static content

Philipp Kraus philipp.kraus at tu-clausthal.de
Wed Oct 30 10:15:42 UTC 2013


Am 29.10.2013 um 21:30 schrieb Francis Daly <francis at daoine.org>:

> On Tue, Oct 29, 2013 at 07:34:15PM +0100, Philipp Kraus wrote:
> 
> Hi there,
> 
>>    location /gitlab {
>>        root /home/gitlab/gitlab/public;
>>        try_files $uri $uri/index.html $uri.html @gitlab;
> 
> I suspect that the "$uri/index.html" there may cause you problems. You
> may be better off using "$uri/" instead.

I have changed it to

    location /gitlab {
        alias /home/gitlab/gitlab/public;
        try_files $uri/ @gitlab;
    }

that does not work also. I have tested it with the "try_files $uri $uri.css".

> 
>> I get this error:
>> 
>> [error] 4573#0: *4 open() "/home/www/static.css" failed (2: No such file or directory)
> 
> What url did you access to get this message?
> 
> What file on the filesystem did you want it to serve for that url?

The message shows:

2013/10/30 11:10:18 [error] 6692#0: *5 open() "/home/www/static.css" failed (2: No such file or directory), client: <ip>, server: <server>,
request: "GET /static.css HTTP/1.1", host: "<server>", referrer: "https://server/gitlab/profile/keys"

> 
>> How can I tell my location rule, that static content is stored in the correct root folder?
> 
> You may need to use "alias" rather than "root"; but that should become
> clear when you describe the url -> filename mapping that you want.

I try to port this configuration https://github.com/gitlabhq/gitlabhq/blob/master/lib/support/nginx/gitlab
to the subdirectory, so GitLab is not called on https://myserver/ but rather https://myserver/gitlab


Thanks for help

Phil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20131030/71e4d07b/attachment-0001.html>


More information about the nginx mailing list