Welcome! Log In Create A New Profile

Advanced

location for php except

Philipp Kraus
June 01, 2014 01:40PM
Hello,

I'm using nginx with Gitlab, so in the Gitlab some PHP projects are hosted and on other directory there exists some PHP scripts.

For the PHP files I use:

location ~ \.php$ {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
if (!-f $document_root$fastcgi_script_name)
{
return 404;
}

fastcgi_pass 127.0.0.1:9000;
include /etc/nginx/fastcgi_params;
try_files $uri $uri/ =404;
}

and for my Gitlab I'm using:

location /gitlab
{
alias /home/gitlab/gitlab/public;
try_files $uri @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://gitlab;
}

The problem at the moment is, that if a PHP file is hosted in a Gitlab repository the location ~\.php$ is matched first.
So how can I change the locations, that all PHP files, which URL has got the part /gitlab it should be passed to Gitlab and
otherwise it should be passed to the fastcgi call e.g.

myserver/gitlab/user/repository.git/master/test.php should be handled by Gitlab and myserver/somedirectory/test.php should be
handled by the fastcgi call.

Thanks a lot

Phil

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

location for php except

Philipp Kraus June 01, 2014 01:40PM

Re: location for php except

Francis Daly June 01, 2014 02:18PM

Re: location for php except

Philipp Kraus June 01, 2014 03:02PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 302
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready