Last Updated on

Setting up your own web proxy website can keep you floating even when most of the internet unblocking services will not work. Access to a web proxy appears to your Internet service provider as a normal web traffic.  To setup it, the first thing to decide is whether you want to setup your web proxy on a shared hosting plan or do you plan to establish your website on a dedicated server or a virtual private server. If you want to setup it over a shared hosting plan it will only serve you personally and not many people can use it simultaneously. Shared hosting is usually very limited in terms of system resources but they are best for beginners. Hosting providers have great tutorials and also offer extensive support that are mostly included with the packages.

Prerequisites

  • You need a domain name, you will need to purchase one from a domain registrar like namecheap. If you are looking to just play and test things out, you can get free domains from Freenom.
  • You will need a shared hosting plan from a web hosting provider like namecheap or a VPS or a dedicated Server if you plan to cater more people.

Install Proxy Website on Shared Hosting

This method works fine for shared hosting services and also when you cannot connect or have no console access to the server your sites are being hosted on. This is pretty easy and straight forward.

  • Download the pre-compiled files of web proxy zip file and upload them to your public directory of web server.

Upload & Extract in the root of your public directory or move the web proxy files in your desired folder inside your public directory. Ask for help from your hosting service provider if you are not sure. Essentially you are looking for something like a File Manager. It may look different and ways to access it may be different for different web hosting providers. Do not freak out if it does not look the same at your end.

Setup your own proxy website using PHP-Proxy 1
Look for File manager in your hosting provider

After Upload & Extract, the files will look something like the following

PHP web proxy files

Now we need to do one more thing before we can start using our proxy site. Edit the file ‘config.php’. The config.php file has the following content.

<?php
// all possible options will be stored
$config = array();
// a unique key that identifies this application - DO NOT LEAVE THIS EMPTY!
$config['app_key'] = '';
// a secret key to be used during encryption
$config['encryption_key'] = '';
/*

...
...

We need to add a random value for $config['app_key']= '';

<?php
// all possible options will be stored
$config = array();
// a unique key that identifies this application - DO NOT LEAVE THIS EMPTY!
$config['app_key'] = 'hyperbyte.net';
// a secret key to be used during encryption
$config['encryption_key'] = '';
/*

...
...

That’s it. Save the file and close it.

Web Proxy

Now you can use your web proxy by visiting your domain name ‘YourDomainName.com’.

Install PHP-Proxy on VPS/Dedicated Server Ubuntu 18.04

For VPS and Dedicated Servers, We need to setup web server first then we will setup PHP-Proxy over it. There are two commonly used web server applications, Apache and Nginx. There is a slight difference in setting up each. If this does not concern you I will advise you to go with Nginx. In my opinion, it has better memory management than Apache.

Setting up Nginx Web Server

SSH into your server and execute the following commands as root in sequence.

sudo apt update 
sudo apt install nginx
sudo apt install php7.2-fpm php7.2-curl php7.2-mbstring php7.2-xml php7.2-zip

Now we need to install composer then we can install PHP-Proxy with it in our root directory.

sudo apt install composer

Remove any default files in the root folder

sudo rm /var/www/html/*

Now installing PHP-Proxy with Composer.

sudo composer create-project athlon1600/php-proxy-app:dev-master /var/www/html

Change the permission settings and assign web server user all access to website directory.

sudo chown www-data:www-data /var/www/html/ -R

After it is done we need to configure Nginx Web Server.

NGINX Conifguration

Before we proceed to use our PHP-proxy installation we need to configure our web server so that it knows what files point to what domain name and how to execute any PHP scripts.


This is important. Change YourDomainName.com to the name of your domain.

sudo nano /etc/nginx/sites-available/YourDomainName.com

Copy and paste the below contents and edit YourDomainName.com www.YourDomainName.com accordingly.

server {
listen 80;
root /var/www/html;
index index.php index.html index.htm index.nginx-debian.html;
server_name YourDomainName.com www.YourDomainName.com;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
}
add_header X-Content-Type-Options nosniff;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";

location ~ /\.ht {
deny all;
}
}

Link this file to sites-enabled.

sudo ln -s /etc/nginx/sites-available/YourDomainName.com /etc/nginx/sites-enabled/
sudo unlink /etc/nginx/sites-enabled/default

Restart the web server service so that it can load with new configuration.

sudo systemctl reload nginx

Now if you followed every step carefully and accurately you will be able to access the web proxy by just visiting YourDomainName.com.

Installing SSL Encryption (Let’s Encrypt) [Optional]

If you want to use our web proxy securely then you must install SSL encryption that is HTTPS. It is free and provided by Let’s Encrypt. Execute the following commands to set HTTPS over YourDomainName.com

sudo add-apt-repository ppa:certbot/certbot

Press [ENTER] to continue.

sudo apt install python-certbot-nginx

This is important. Change YourDomainName.com & www.YourDomainName.com to the name of your domain.

sudo certbot --nginx -d YourDomainName.com -d www.YourDomainName.com 

You will be asked to enter an email address and then must agree to the terms of service. If certbot assigns a SSL certificate it will ask you about redirecting all traffic to secure HTTPS or you want to keep insecure and ssl access enabled.

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
1: No redirect – Make no further changes to the webserver configuration.
2: Redirect – Make all requests redirect to secure HTTPS access.

You can select option 2 here as we want a secure web proxy connection. And after you press [ENTER] certbot will make necessary changes to redirect all traffic to HTTPS only.

You work here is done. You can check your site will be working with https://YourDomainName.com. Comment if you run into any issues or want to add something.

Shared hosting plan for Web proxy

This Post Has One Comment

Leave a Reply

Close Menu