Php proxy with ssl

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

HTTP/HTTPS proxy that allows to redirect traffic

paxal/phproxy

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

PHProxy is an HTTP/HTTPS proxy built for development purpose, with custom name resolution.

Currently, is supports HTTPS protocol, and might support HTTP protocol in some conditions, and websocket as well.

Clone this repository or download a release on github.

Example : run locally on port 8001.

./bin/phproxy run 127.0.0.1:8001
  • —config file : will load configuration from this file.
  • —save : will load configuration file, apply changes, and save it again, and then run the proxy.
  • —translate from=to : will connect to to instead of from . Could be either ips or domain names for both from and to .

Translations can also be all subdomains, for instance .original.com=.target.net . Then

  • www.original.com will be redirected to www.target.net
  • BUT original.com will not be redirected.

Some browsers/extensions support SSL Proxies. Thus, you can configure the proxy to run on ssl :

  • —ssl : will activate SSL support.
  • —ssl-cert : use this file as PEM certificate file (with chain).
  • —ssl-key : use this file as PEM private key.
  • —ssl-passphrase : pass phrase for private key.

One MUST consider security when running a proxy : run the proxy behind a firewall, or add security, ideally over SSL transport.

About

HTTP/HTTPS proxy that allows to redirect traffic

Источник

How to install PHP Proxy on a Debian/Ubuntu NVMe VPS Server

How to install PHP Proxy on a Debian/Ubuntu NVMe VPS Server

PHP Proxy will allow you to host a proxy service on a VPS or Dedicated server. It’s not a complicated setup and this article will guide you through the process. A Proxy is a way to circumvent blocks put in place. This could be a block by an ISP or government. You visit the proxy over HTTPS, enter the website URL and the proxy server will grab the website for you and display it. The IP of the proxy is shown to the website. Your IP is kept hidden. Unlike other Proxy software like Squid Proxy. PHP Proxy provides an interface to type URLs into.

Читайте также:  Plotting coordinates in python

Most Proxy services don’t keep logs of activity and we’re not going to either. We have already set up a basic proxy service at prox.onl. In this article, we will be adding a UK proxy to the existing network. The actual website for the proxy is not pretty. It’s just designed as a test.

Install Nginx and PHP

This guide assumes you have a Debian NVMe VPS running Debian 9 or Debian 10. It’s untested on Debian 11 as of writing this article but should work. As the root user, run the commands below. Your Proxy server should have a hostname that resolves to it.

 # Run installer. If using Debian 9/Ubuntu 18, install php7.0. If using a newer OS # install a newer PHP (apt install php7.4 php7.4-fpm etc) apt install nginx apt install apache2 apt install php7.0 php7.0-fpm php7.0-curl php7.0-mbstring php7.0-xml php7.0-zip systemctl enable nginx systemctl enable php7.0-fpm # Install Composer apt install composer 

Install PHP Proxy

So now that you have NGINX and PHP installed, it’s time to install PHP Proxy. But first, we should remove the default HTML files.

Next, use Composer to set up PHP Proxy. The files will be deployed to the /var/www/html folder. But if you want to point the files to a different location. Update the path.

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

At this point, we need to allow NGINX access to the files and folder. We CHOWN the folder with the -R flag

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

Configure NGINX

So now we need to make some changes to NGINX so it knows what domain name we want to use and where the files for this domain name are located. We already know they are located at /var/www/html. First, we need to create a configuration file. Create the file, switching the name of the file for your domain or subdomain.

nano /etc/nginx/sites-available/uk.prox.onl

And inside the file, paste the below code.

server < listen 80; root /var/www/html; index index.php index.html index.htm index.nginx-debian.html; server_name uk.prox.onl www.prox.onl; location / < try_files $uri $uri/ =404; proxy_busy_buffers_size 512k; proxy_buffers 4 512k; proxy_buffer_size 512k; fastcgi_connect_timeout 60; fastcgi_send_timeout 300; fastcgi_read_timeout 300; >location ~ \.php$ < include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php/php7.4-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; >>

NOTE- Modify the following sections. If PHP 7.4 is installed, there is no need to modify the fastcgi_pass unix section. But If you are using 7.0, update the path to the FPM socket. Its usually /var/run/php/php7.0-fpm.sock. If you get this bit wrong, you will see 503 errors when visiting the Proxy Server.

We’ve added some additional PHP-FPM settings to this article since it was written. These will help prevent errors.

Enable Configuration

Now we need to disable the default configuration and enable the new confirmation we just created. If you want to use SSL, don’t worry, we will configure this last. So use the commands below to unlink the default configuration and link the new one. Update the command with your domain name.

# Unlink Default config unlink /etc/nginx/sites-enabled/default # Link new config ln -s /etc/nginx/sites-available/uk.prox.onl /etc/nginx/sites-enabled/ # Reload NGINX systemctl reload nginx 

You should now have a working proxy. Visit your domain name and try it out. It’s likely you will want to configure an SSL so, let’s finish up with that.

Читайте также:  Форма бронирования на php

Configure PHP Proxy to use SSL

Configuring servers with an SSL used to be tedious but with Certbot it became a lot easier. With NGINX it’s even easier because we can do everything automatically. Let’s get started.

Install Certbot

Install the dependencies for Certbot and Certbot itself.

apt install certbot python3-certbot-nginx

Next, generate an SSL. You would enter your domain name or subdomain or both. We are using a subdomain so we just need our certificate to cover uk.prox.onl.

sudo certbot --nginx -d uk.prox.onl 

And finally, to send all traffic to SSL. Select option 2 which is displayed in the console now. So if you visit your site now, the connection should be rerouted to SSL. Certbot will renew the certificate when required. That’s it. Installed completed.

Источник

Setup your own proxy website using PHP-Proxy

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.

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.

// 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’] = »;
/*

Читайте также:  Udp java клиент сервер

.
.

We need to add a random value for $config[‘app_key’]= »;

SomethingHere'; // 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 20.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.4-fpm php7.4-curl php7.4-mbstring php7.4-xml php7.4-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.4-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 apt install certbot python3-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.

Источник

Оцените статью