How to Set Up a Private Proxy Server on a VPS with Shadowsocks


Before we begin, make sure you have the following prerequisites in place:

  • A VPS (Virtual Private Server) running a Linux distribution (Ubuntu 20.04 or later recommended)
  • Root or sudo access to the VPS
  • Basic knowledge of the Linux command line
  • Shadowsocks client installed on your local device

Step 1: Update Your VPS

Start by updating your VPS to ensure that your system is running the latest patches. Run the following commands:

 sudo apt update && sudo apt upgrade -y 

Step 2: Install Shadowsocks on Your VPS

Shadowsocks can be installed on Ubuntu by using the following steps:
First, install the necessary dependencies:

 sudo apt install -y python3-pip python3-setuptools 

Next, install Shadowsocks using the pip package manager:

 sudo pip3 install shadowsocks 

Step 3: Configure Shadowsocks

Once Shadowsocks is installed, you need to configure it to run as a proxy server. You will configure the server to listen for incoming connections and forward them securely.
Create a configuration file for Shadowsocks:

 sudo nano /etc/shadowsocks.json 

Add the following configuration to the file, adjusting the values for your specific needs:

 { "server": "0.0.0.0", "server_port": 8388, "password": "your_password_here", "timeout": 300, "method": "aes-256-gcm" } 

server: Set this to 0.0.0.0 to allow connections from all IP addresses.
server_port: This is the port on which your Shadowsocks server will listen (default is 8388).
password: Set a strong password to protect your proxy server.
timeout: Set the timeout for connections (in seconds).
method: Choose an encryption method (in this case, aes-256-gcm).
Save and close the file by pressing CTRL + X, then press Y, followed by Enter.

Step 4: Start Shadowsocks Server

To start the Shadowsocks server, use the following command:

 sudo ssserver -c /etc/shadowsocks.json -d start 

This will launch the Shadowsocks server and keep it running in the background.

Step 5: Enable Shadowsocks to Start on Boot

To ensure that your Shadowsocks server starts automatically when your VPS reboots, create a systemd service.
Create a new systemd service file for Shadowsocks:

 sudo nano /etc/systemd/system/shadowsocks.service 

Add the following content to the service file:

 [Unit] Description=Shadowsocks Proxy Server After=network.target [Service] ExecStart=/usr/local/bin/ssserver -c /etc/shadowsocks.json Restart=on-failure [Install] WantedBy=multi-user.target 

Save and close the file by pressing CTRL + X, then press Y, followed by Enter.
Reload systemd and enable the Shadowsocks service:

 sudo systemctl daemon-reload sudo systemctl enable shadowsocks sudo systemctl start shadowsocks 

Step 6: Configure the Firewall

If your VPS has a firewall enabled (e.g., UFW), you need to allow traffic on the Shadowsocks port (default 8388). To do this, run:

 sudo ufw allow 8388 sudo ufw reload 

Step 7: Set Up Shadowsocks Client

After successfully setting up your Shadowsocks server, you need to configure the Shadowsocks client on your local device to connect to the VPS. You can install Shadowsocks on various platforms such as Windows, macOS, iOS, and Android.
Download and install the Shadowsocks client for your device.
Open the client and configure it with the following details:
Server: Your VPS IP address
Server Port: 8388 (or the port you configured)
Password: The same password you set in the configuration file
Encryption Method: aes-256-gcm (or the method you selected)
Save the configuration and connect to your Shadowsocks server.

Step 8: Testing the Connection

After configuring the client, test the connection by opening a browser or running a command to verify that your internet traffic is now being routed through the Shadowsocks proxy server.
To test the connection, you can use a website like https://www.whatismyip.com/ to check if your IP address reflects the VPS’s IP.

Conclusion

By following these steps, you should now have a fully functional private proxy server set up on your VPS using Shadowsocks. This configuration ensures that your internet traffic is encrypted and securely routed through your VPS, allowing you to bypass censorship and maintain privacy.

We earn commissions using affiliate links.


14 Privacy Tools You Should Have

Learn how to stay safe online in this free 34-page eBook.


Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top