0

In my /etc/nginx/nginx.conf

1st example:

location ~ ^/~(.+?)(/.*)?$ {
    alias /home/$1/web$2;
    index  index.html index.htm;
}

It means if I visit httpwebsite/~user1/ it will redirect web folder to /home/user1/web

and If I visit httpwebsite/~nextuser/ it will redirect to /home/nextuser/web

2nd example: Now I want to do the same with scgi mount:

location ~ ^/RPC-user1$ {
    include scgi_params;
    scgi_pass /home/user1/scgi.socket;
}
location ~ ^/RPC-nextuser$ {
    include scgi_params;
    scgi_pass /home/nextuser/scgi.socket;
}

How to translate this 2 lines of code to wildcard 1 line like the 1st example? Basically passing anything like /RPC-$USERNAME to scgi_pass /home/$USERNAME/scgi.socket

1 Answers1

1

Try this:

location ~ ^/RPC-(.+)$ {
    include scgi_params;
    scgi_pass /home/$1/scgi.socket;
}
Tan Hong Tat
  • 6,671
  • 2
  • 27
  • 25
  • thanks, this is what i looking for. I hope it doesn't match website.com/anything/RPC-user1 and only match website.com/RPC-user1 – user1758470 Jan 27 '14 at 15:31