Shadowsocks
nano /etc/shadowsocks/config.json
nano /etc/shadowsocks/config.json
nano /etc/shadowsocks/config.json
{
"server":"127.0.0.1",
"server_port":10001,
"password":"password",
"mode":"tcp_only",
"timeout":300,
"method":"chacha20-ietf-poly1305",
"plugin":"v2ray-plugin_linux_amd64",
"plugin_opts":"server;path=/ss;loglevel=none", # loglevel=debug
"nameserver":"1.1.1.1"
}
{
"server":"127.0.0.1",
"server_port":10001,
"password":"password",
"mode":"tcp_only",
"timeout":300,
"method":"chacha20-ietf-poly1305",
"plugin":"v2ray-plugin_linux_amd64",
"plugin_opts":"server;path=/ss;loglevel=none", # loglevel=debug
"nameserver":"1.1.1.1"
}
{ "server":"127.0.0.1", "server_port":10001, "password":"password", "mode":"tcp_only", "timeout":300, "method":"chacha20-ietf-poly1305", "plugin":"v2ray-plugin_linux_amd64", "plugin_opts":"server;path=/ss;loglevel=none", # loglevel=debug "nameserver":"1.1.1.1" }
Apache
nano /etc/apache2/apache2.conf
nano /etc/apache2/apache2.conf
nano /etc/apache2/apache2.conf
<VirtualHost *:80>
Servername example.com
RewriteEngine on
RewriteCond %{SERVER_NAME} =example.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URL} [END,NE,R=permanent]
</VirtualHost>
<VirtualHost *:443>
# change your domain
ServerName example.com
# you may have a different root
DocumentRoot /var/www/
# the SSL configuration enable https for your site and it’s also required by shadowsocks + v2ray
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/example.com/privkey.pem
SSLProtocol All -SSLv2 -SSLv3 -TLSv1 -TLSv1.1 +TLSv1.2 +TLSv1.3
SSLCipherSuite HIGH:!aNULL
<Location "/ss">
ProxyPass ws://127.0.0.1:10001/ss
ProxyAddHeaders Off
ProxyPreserveHost On
RequestHeader append X-Forwarded-For %{REMOTE_ADDR}s
</Location>
</VirtualHost>
<VirtualHost *:80>
Servername example.com
RewriteEngine on
RewriteCond %{SERVER_NAME} =example.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URL} [END,NE,R=permanent]
</VirtualHost>
<VirtualHost *:443>
# change your domain
ServerName example.com
# you may have a different root
DocumentRoot /var/www/
# the SSL configuration enable https for your site and it’s also required by shadowsocks + v2ray
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/example.com/privkey.pem
SSLProtocol All -SSLv2 -SSLv3 -TLSv1 -TLSv1.1 +TLSv1.2 +TLSv1.3
SSLCipherSuite HIGH:!aNULL
<Location "/ss">
ProxyPass ws://127.0.0.1:10001/ss
ProxyAddHeaders Off
ProxyPreserveHost On
RequestHeader append X-Forwarded-For %{REMOTE_ADDR}s
</Location>
</VirtualHost>
<VirtualHost *:80> Servername example.com RewriteEngine on RewriteCond %{SERVER_NAME} =example.com RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URL} [END,NE,R=permanent] </VirtualHost> <VirtualHost *:443> # change your domain ServerName example.com # you may have a different root DocumentRoot /var/www/ # the SSL configuration enable https for your site and it’s also required by shadowsocks + v2ray SSLEngine on SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/example.com/privkey.pem SSLProtocol All -SSLv2 -SSLv3 -TLSv1 -TLSv1.1 +TLSv1.2 +TLSv1.3 SSLCipherSuite HIGH:!aNULL <Location "/ss"> ProxyPass ws://127.0.0.1:10001/ss ProxyAddHeaders Off ProxyPreserveHost On RequestHeader append X-Forwarded-For %{REMOTE_ADDR}s </Location> </VirtualHost>
References
https://guide.v2fly.org/en_US/advanced/wss_and_web.html#server-side-configuration
https://big533.cc/wordpress/index.php/2020/01/03/v2ray-setup-with-websocket-tls-using-apache/
https://github.com/KonaisPC/v2ray-apache-ws/blob/master/v2ray-apache.sh