Right location for location /

I was trying to add

try_files $uri $uri/ /yourls-loader.php?$args;

to the location /, till I found that the right place for it was in the /etc/nginx/common/php.conf (it’s a yourls installation).

But I feel this is not the best place to do that, since it can be gone in an upgrade.

Is there a right place to add this without getting the “duplicate location” error?

Try location ^/ or location ~^, or any other variation, just to avoid duplicate location.

The right place to it is in a file something.conf in /var/www/domain.com/conf/nginx/.

1 Like