Sign inSign up

jfca68/shadowsocks-server

By jfca68

Updated 7 months ago

Docker image for Shadowsocks server with v2ray-plugin WebSocket transport

Image
Networking
0

1.0K

jfca68/shadowsocks-server repository overview

Shadowsocks + v2ray-plugin Docker Image

A lightweight Docker image that runs Shadowsocks server with v2ray-plugin for WebSocket transport over TLS.

Quick Start

docker run -d \
  --name shadowsocks-server \
  --restart unless-stopped \
  -p 8389:8389 \
  -e SHADOWSOCKS_PASSWORD=your_secure_password \
  -e SHADOWSOCKS_HOST=your_domain.com \
  jfca68/shadowsocks-server:latest

Environment Variables

  • SHADOWSOCKS_PASSWORD - Password for the Shadowsocks server (required)
  • SHADOWSOCKS_HOST - Host for the WebSocket connection (default: skiprestriction.uk)
  • SHADOWSOCKS_PATH - WebSocket path (default: /shadowsocks)
  • SHADOWSOCKS_METHOD - Encryption method (default: aes-256-gcm)
  • SHADOWSOCKS_SERVER_PORT - Server port (default: 8389)

Nginx Configuration

This container is designed to work with Nginx on the host system for SSL termination. Here's an example configuration:

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name your_domain.com www.your_domain.com;

    # For Let's Encrypt ACME challenges
    location /.well-known/acme-challenge/ {
        root /var/www/certbot;
        try_files $uri $uri/ =404;
    }

    # WebSocket proxy for Shadowsocks container
    location /shadowsocks {
        proxy_pass http://127.0.0.1:8389;  # Points to your container
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_read_timeout 300;

        # Hide nginx version from error pages
        proxy_hide_header X-Powered-By;
        proxy_hide_header Server;
    }

    # Optional: Redirect root to a landing page or return 404
    location / {
        return 404;
    }
}

# HTTP server to redirect to HTTPS
server {
    listen 80;
    listen [::]:80;
    server_name your_domain.com www.your_domain.com;

    location /.well-known/acme-challenge/ {
        root /var/www/certbot;
        try_files $uri $uri/ =404;
    }

    # Redirect all other HTTP traffic to HTTPS
    return 301 https://$server_name$request_uri;
}

Complete Deployment Guide

  1. Start the container:
docker run -d \
  --name shadowsocks-server \
  --restart unless-stopped \
  -p 8389:8389 \
  -e SHADOWSOCKS_PASSWORD=your_secure_password \
  -e SHADOWSOCKS_HOST=your_domain.com \
  jfca68/shadowsocks-server:latest
  1. Configure and start Nginx with the configuration above

  2. Obtain SSL certificates using Certbot:

sudo certbot --nginx -d your_domain.com

Shadowrocket Client Configuration

In Shadowrocket, add a new server with these settings:

  • Server: your_domain.com
  • Port: 443 (SSL port)
  • Password: your_secure_password
  • Method: aes-256-gcm
  • Plugin: v2ray-plugin
  • Plugin Options: tls;path=/shadowsocks;host=your_domain.com

Features

  • Runs Shadowsocks server with v2ray-plugin WebSocket transport
  • Configurable via environment variables
  • Designed to work with Nginx on the host system for SSL termination
  • Small image size optimized for proxy services
  • Lightweight and efficient

Source Code

The source files for this image are available in the GitHub repository referenced in this page

Tag summary

Content type

Image

Digest

sha256:b16710f73

Size

136.3 MB

Last updated

7 months ago

docker pull jfca68/shadowsocks-server