Tutorial: How to Install PHP-Proxy on Debian

In this tutorial, we will guide you on how to install PHP-Proxy on the latest version of Debian.

Prerequisites

Before starting with the installation process, ensure that you have the following:

  • Debian installed on your server
  • Root access to the server
  • A web server such as Apache or Nginx installed

Step 1: Install Dependencies

First, we need to install some dependencies required by PHP-Proxy. Open the terminal and execute the following command:

sudo apt-get update
sudo apt-get -y install git curl php php-curl php-mbstring composer

This will update the package list and install Git, curl, PHP, PHP-curl, PHP-mbstring, and Composer.

Step 2: Install PHP-Proxy

Now, we will install PHP-Proxy using Git. Run the following commands in the terminal:

cd /var/www
sudo git clone https://github.com/Athlon1600/php-proxy-app.git php-proxy
cd php-proxy
sudo composer install

Step 3: Configure PHP-Proxy

Next, we need to configure PHP-Proxy to work with our web server.

Configure Apache

If you are using Apache, open the configuration file with your favorite text editor by running the following command:

sudo nano /etc/apache2/sites-available/000-default.conf

Add the following code block inside the <VirtualHost> tag:

<VirtualHost *:80>
    ServerName example.com
    DocumentRoot /var/www/php-proxy/public
    <Directory /var/www/php-proxy/public>
        AllowOverride All
        Require all granted
    </Directory>
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Make sure to replace example.com with your own domain name.

Save and close the file by pressing Ctrl+X, followed by Y, and then Enter.

Configure Nginx

If you are using Nginx, open the configuration file with your favorite text editor by running the following command:

sudo nano /etc/nginx/sites-available/default

Add the following code block inside the server block:

server {
    listen 80;
    server_name example.com;
    root /var/www/php-proxy/public;
    index index.php index.html index.htm;
    location / {
        try_files $uri $uri/ /index.php$is_args$args;
    }
    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
      	fastcgi_pass unix:/run/php/php7.4-fpm.sock;	# Replace with your PHP version
    }
    location ~ /\.ht {
        deny all;
    }
    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;
}

Make sure to replace example.com with your own domain name and fastcgi_pass with the appropriate value for your PHP version.

Save and close the file by pressing Ctrl+X, followed by Y, and then Enter.

Step 4: Restart the Web Server

After configuring the web server, we need to restart it to apply the changes. Run the following command:

Restart Apache

sudo systemctl restart apache2

Restart Nginx

sudo systemctl restart nginx

Step 5: Test PHP-Proxy

Visit http://example.com in your web browser, replacing example.com with your domain name. If you see the PHP-Proxy homepage, it means that the installation was successful.

Conclusion

In this tutorial, we have shown you how to install PHP-Proxy on the latest version of Debian. By following these steps, you can easily set up your own proxy server and access websites that are blocked in your region.