ubuntu proxy server settings

Prepare:

  • Have a public IP server (Ubuntu 18.04.4 LTS, Alibaba Cloud)
  • Local computer (Ubuntu 20.04 LTS)

operate:

  1. Install the program tinyproxy on the server.

  apt update

  apt install tinyproxy

  2. Open the configuration file on the server

  vim /etc/tinyproxy/tinyproxy.conf

  3. Find the following parameters in the configuration file and make changes

  #Define the listening port, the default port is 8888, of course you can change it to your favorite port.

  #If the port number is less than 1024, you need to use root to start tinyproxy.

  Port 8888

  #Define the IPs that are allowed to connect. By default, only the local computer is allowed to connect.

  #If you add # in front to block this parameter, everyone is allowed to connect.

  #Allow 127.0.0.1

  4. Open the port on the server

  The local computer can connect to the server only if the port defined by the Port parameter is opened.

  5. Test

  Set the proxy in the local computer firefox browser: Preferences -> Network Settings -> Manual proxy configuration. Enter the server IP address and port number in the HTTP proxy option.

  Use the IP query tool to judge whether the proxy is successful: if the IP address is the server IP address, and the geographical location is displayed as the server location, the proxy is successful.

                   If the IP address is the IP address of the local computer, and the geographical location is displayed as the location of the local computer, then the agent fails. Please double check whether the server port is open.

  If you want all programs on the computer to connect to the network through a proxy, you need to set the global proxy on the local computer.

  Local computer global proxy settings: System Settings -> Network -> Network Proxy. Select Manual in the settings option of the network proxy, and then enter the server IP address and port number in the HTTP proxy option.

6. Additional tasks

  Set up cron to prevent memory leaks.

  Use the command crontab -e to edit the crontab file and add the following:

  0 2 * * * /etc/init.d/tinyproxy restart

  Note: According to my own test, when tinyproxy is running for a long time, there may be a problem that the client does not respond when connecting to the server. Especially when there is no client connection for a long time, the server is idle for a long time.

    You can avoid this problem by setting the tinyproxy service to restart every 2 hours.

  Note: 1. My original intention is to solve the problem that CS:GO fails to connect to any official server. Changing the DNS can occasionally solve this problem. But there are always exceptions, but this method is used helplessly, and the problem is solved after proxying. At this time, you need to set the computer global proxy.

    2. This setting is only for personal temporary use. If it is used for other purposes, other options need to be set to ensure safety.

https://www.cnblogs.com/khdxs7/p/12879905.html

Guess you like

Origin blog.csdn.net/Steven_yang_1/article/details/130585159