There is a url: http://ip/deberc/js/main.js

deberc is the name of the game. There is a task based on this name to connect configs:

 include /home/$gameName/nginx/*.conf; 

That is, the task is to shove deberc into the $ gameName variable.

How can I do that?

1 answer 1

Focusing on this answer , for example, you can:

 if ( $request_uri ~ ^/(.*)/ ) { include /home/$1/nginx/*.conf; } 

however, I’m not sure that .* doesn’t even include other parts of the url along with the slashes. if you “pick it up”, try, for example, like this:

 if ( $request_uri ~ ^/([^/]+)/ ) { 

if you only need to assign a value to a variable, then replace:

  include /home/$1/nginx/*.conf; 

on:

  set $gameName $1;