location for php except

Francis Daly francis at daoine.org
Sun Jun 1 18:16:13 UTC 2014


On Sun, Jun 01, 2014 at 07:37:51PM +0200, Philipp Kraus wrote:

Hi there,

> 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$ {
<snip>
> and for my Gitlab I'm using:
> 
> location /gitlab

> The problem at the moment is, that if a PHP file is hosted in a Gitlab repository the location ~\.php$ is matched first.

Strictly, it's that this location is the one that best matches the
request. ("first" doesn't really apply.)

See http://nginx.org/r/location for details.

> 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.

If by "has got the part" you mean "starts with exactly the string",
then pay particular attention to the "^~" modifier,

(If not, then pay attention to the order of regexes.)

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list