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 Answer 1

1

Try this:

location ~ ^/RPC-(.+)$ {
    include scgi_params;
    scgi_pass /home/$1/scgi.socket;
}
Sign up to request clarification or add additional context in comments.

1 Comment

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.