How to configure Nginx as proxy for TWO instances of Shadowsocks
June 12, 2022 10:02AM
Hello, everyone!

OS Ubuntu 20.04 Server

I am trying to configure Nginx as a proxy for TWO instances of Shadowsocks.

1. 1st Shadowsocks (later - ss) instance is clear (no plugins) and using port 8008.
2. 2nd SS instance using plugin v2Ray and port 8009.

Optionally I am using request redirection on the youtube.com and web-admin for AdGuard.

So I have set up locations at /etc/nginx/sites-available/default

location ^~ / {
proxy_pass https://youtube.com;
limit_rate 1000k;
proxy_redirect off;
}

location /aghome/ {
proxy_pass http://127.0.0.1:8180/;
proxy_redirect / /aghome/;
proxy_cookie_path / /aghome/;
}
location = /cleanss { ## NOT working
proxy_redirect off;
proxy_buffering off;
proxy_http_version 1.1;
proxy_pass http://localhost:8008/;
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
## access_log /var/log/nginx/ss.log;
}
location /v2ray {
proxy_redirect off;
proxy_buffering off;
proxy_http_version 1.1;
proxy_pass http://localhost:8009/;
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
} ## access_log /var/log/nginx/v2ray.log;

}

And Houston, we have a problem ;)

1. Youtube redirection - is working.
2. AdGuard web-admin - is working.
3. SS + v2Ray - - is working fine!

4. Clean SS (location = /cleanss) - is NOT working.
(On the SS client side we have error - 2022-06-12 21:19:56.0426|ERROR|Shadowsocks.Controller.TCPHandler|decryption error , so Nginx redirecting clean SS requests on the SS+v2Ray inctance).

On the SS client side I have set up connection as sitename and port 443.

I am newbe with Nginx and Linux. Please, help me.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 181
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready