Yandex Metrika

How to create a proxy server

Do you need your own proxy server? Not familiar with Linux? Then this article is for you. The steps described below are performed step by step, you create your own elite proxy server (does not include various services as a proxy and hides your real IP address), work over HTTP / HTTPS or SOCKS5 with authorization. It is simply irreplaceable if there are increased requirements for the quality of the proxy. Only you will be on the IP allocated to you, and not a bunch of other users, which will affect the quality and stability in the bill. Even so-called "private proxies" cannot always be private, you cannot check how many people are actually using it. Taking into account the saved money, your expenses will be only VPS rent (from 5 Euro per month) and additional. IP (from 1 Euro) if required, which is comparable to the price of "private proxies".

So, first we need a VPS (virtual dedicated server), preferably with KVM virtualization, because on other types of virtualization, creating proxy servers installed by CentOS 7. Many hosting providers generally prohibit the creation of proxy servers, so before ordering a VPS, check this nuance with those. support. An example of a suitable Moscow hosting. They have servers in Russia (Moscow), Switzerland and Great Britain. VPS rental costs from 5 Euro, add. IP costs 1 Euro, you can connect up to 32 add. IP to one server. Or alternatively, they have servers in Ukraine, Bulgaria, the Netherlands and the USA. Server from 5 Euro. Their those. the support made a good impression. These two hosting examples are chosen so that the countries where their servers are located do not repeat, the choice is yours.

Having received the access data to the ordered server, let's get to work.

1. We connect to the server via ssh. This can be done through the PuTTY program. In the Hostname field, enter the IP of your server, leave the default 22 if you haven't changed it.

How to create a proxy server
When you try to log in, your browser may show a message like "This connection is not trusted ...", ignore it, add it to the exception and enter. After logging in, a command prompt window will appear. Enter your login and password data for you. Please note that when entering a password, it is not displayed, i.e. as if nothing is happening.

How to create a proxy server
After entering <ENTER>, you will either see the message "Access is denied", which means the password was entered incorrectly or your login in brackets as in the screenshot.
How to create a proxy server

2. Install the nano editor:
yum install nano
3. Install the gcc library required for compilation:
yum install gcc
4. Download 3proxy. We will use this program to create a proxy server. The version of 3proxy may change, specify the current one in the line below. (Actual on 09/29/2018)
5. Unzip the downloaded archive with the command:
tar -xvzf 0.9.3.tar.gz
6. Go to the folder with the unpacked files:
cd 3proxy-0.9.3
7. Compile:
make -f Makefile.Linux
During compilation the following errors may appear: "3proxy.c: 1103: warning: pointer targets in passing ...".

Compilation errors other than fatal are okay.

8. Create folders:

* Having typed and executed the first line from the list below, do not rush to type a new one again, just press the "Up" arrow on the keyboard and the last command will be typed. Fill in the missing and that's it.
mkdir /usr/local/etc/3proxy
mkdir /usr/local/etc/3proxy/bin
mkdir /usr/local/etc/3proxy/logs
mkdir /usr/local/etc/3proxy/stat
9. We transfer the executable file:
cp src/3proxy /usr/local/etc/3proxy/bin
10. Transfer the file for autorun:
cp ./scripts/rc.d/ /etc/init.d/3proxy
11. We write information to the startup file:
chkconfig 3proxy on
12. Create a new configuration file:
touch /usr/local/etc/3proxy/3proxy.cfg
13. We expose the rights:
chown -R nobody:nobody /usr/local/etc/3proxy
14. Go to the folder:
cd /usr/local/etc/3proxy
15. Enter the file you want to edit:
nano 3proxy.cfg
16. Configuring 3proxy.cfg. There are a lot of options for setting it up, below we give a relatively simple option that meets our requirements described at the beginning of the article.

#logs and shelf life
log /var/log/3proxy.log Drotate 3


nscache 65536

pidfile /usr/local/etc/3proxy/

#user and pass
users login:CL:pas
auth strong
allow login
maxconn 200

proxy -n -p7459 -i111.111.111.111 -e111.111.111.111
proxy -n -p7459 -i222.222.222.222 -e222.222.222.222

socks -p2233 -i111.111.111.111 -e111.111.111.111
socks -p2233 -i222.222.222.222 -e222.222.222.222
Insert instead of "login" and "pas" your login and password that you will use for authorization. Then, instead of units, enter your IP, if you have several IPs, copy these lines and put new IPs in each one, -p is the port number, it also changes at your discretion. In this configuration, 2 IPs are used to work over HTTP / HTTPS and SOCKS protocols, if SOCKS is not needed, do not write the last lines starting with socks. Save and exit the editor by pressing CTRL + X and confirm the changes.

17. Disable the firewall if the server has nothing but a proxy and it is clearly not needed.

service iptables stop
If necessary, you can add the ports we need to the exception.

CentOS 6
iptables -I INPUT -p tcp --dport 7459 -m state --state NEW -j ACCEPT
iptables -I INPUT -p tcp --dport 2233 -m state --state NEW -j ACCEPT
service iptables save
CentOS 7
Or manually write these lines into /etc/sysconfig/iptables and restart iptables

Instead of "7459" and "2233" enter your ports.

18. If you have more than 1 IP, you need to register them in the system:

ifconfig eth0:1 inet netmask

Where is your add. IP. If there are more IP addresses, besides IP, change the eth0: 1 value to eth0: 2, eth0: 3, etc. each time.

19. Run 3proxy:

service 3proxy start

Congratulations! Now you have your own elite proxy server. It is possible that after starting, a message may appear as in the screenshot below - do not pay attention.

P.S. Recently, a proxy server was required again, I tried to raise it according to my own article and ... it did not work. Article 4 years, during this time changed the hosting, and there apparently its own nuances. In short, they use an internal IP different from the external one, although this was provided in the server configuration file, but it did not work. The connection was established, authorization took place, and then an error occurred. Server on CentOS 7, version 3proxy 0.8.12. If you have a similar problem, try this config (3proxy.cfg):

log /usr/local/etc/3proxy/logs/3proxy.log Drotate 3
pidfile /usr/local/etc/3proxy/
nscache 65536
users login:CL:pas
auth strong
socks -p1234 -i111.111.111.111 -e111.111.111.111

If you need a proxy (in this case socks 5 with authorization) without problems and unnecessary settings - try this config, or replace socks with a proxy if necessary, the main thing is not to specify the IP. Do not forget to replace the username and password with your own, and of course the port itself. When I tried to start the proxy, I received an error about insufficient rights. With the help of chmod, I found the required file and set the permissions a little higher than 644 for the owner and group, this turned out to be enough - it started.
Share this Post:

Want a Consultation or an Advice? Ask a MivoCloud Expert. It's Free.

Our customer support is ready 24/7/365 to help you. Don't guess, just ask now. Contact Us