Configuring a Web Proxy on Ubuntu 24.04 Server
08:25, 28.07.2026
As the internet evolves, privacy and security become paramount for users navigating the vast digital landscape. One effective solution for enhancing online privacy is to set up a web proxy. This article will guide you through configuring a web proxy on Ubuntu 24.04 server, ensuring a secure and efficient browsing experience.
Requirements
Before diving into the configuration process, it’s essential to ensure that you have the necessary requirements in place:
- Ubuntu 24.04 Server: This tutorial assumes you are using an Ubuntu 24.04 VPS (Virtual Private Server), which is known for its stability and ease of use.
- Root Access: Ensure you have root or sudo privileges on your server to install and configure the necessary software.
- Basic Knowledge of Linux Command Line: Familiarity with the command line interface will help you follow along more effectively.
Step 1: Set Up Web Server and PHP
The first step in configuring a web proxy on Ubuntu 24.04 is to set up a web server and PHP. For this guide, we will be using Nginx, a lightweight and high-performance web server known for its efficiency in handling concurrent connections.
Installing Nginx
- Update Your Package List
Begin by updating your package repository to ensure you have the latest software versions.
sudo apt update
- Install Nginx
Install Nginx using the following command:
sudo apt install nginx
- Start and Enable Nginx
After installation, start the Nginx service and enable it to run on system startup.
sudo systemctl start nginx
sudo systemctl enable nginx
Installing PHP
- Install PHP and Necessary Extensions
To enable PHP processing on your web server, install PHP along with essential extensions.
sudo apt install php-fpm php-mysql
- Configure PHP Processor
Open the PHP configuration file to ensure that PHP processes are correctly set up.
sudo nano /etc/php/7.4/fpm/php.ini
Look for the line `cgi.fix_pathinfo=1` and ensure it's uncommented. This setting helps PHP understand how to execute scripts correctly.
- Restart PHP-FPM Service
After editing the configuration file, restart the PHP service for the changes to take effect.
sudo systemctl restart php7.4-fpm
Step 2: Obtain Glype or PHP-Proxy
To implement the web proxy functionality, you can choose between two popular solutions: Glype and PHP-Proxy. Both are excellent options, but they cater to slightly different needs.
Glype Details
Glype is a popular PHP-based web proxy that is easy to set up and use. Here’s how to obtain and install Glype:
- Download Glype
Navigate to the Glype official website to download the latest version.
cd /var/www/html
wget https://github.com/Glype/Glype/archive/refs/heads/master.zip
- Extract the Files
Unzip the downloaded file and rename the directory for easier access.
unzip master.zip
mv Glype-master glype
- Set Permissions
Set the appropriate permissions for the Glype directory.
sudo chown -R www-data:www-data glype
PHP-Proxy Overview
PHP-Proxy is another excellent option for creating a web proxy. It is more lightweight compared to Glype, making it suitable for users with simpler requirements. The installation process is similar to Glype:
- Download PHP-Proxy
Use the following command to download PHP-Proxy.
cd /var/www/html
wget https://github.com/philippkueng/PHP-Proxy/archive/refs/heads/master.zip
- Extract the Files
Unzip the downloaded file and rename it appropriately.
unzip master.zip
mv PHP-Proxy-master php-proxy
- Set Permissions
Change the ownership to allow the web server to access the files.
sudo chown -R www-data:www-data php-proxy
Step 3: Set Up Web Server Configuration
Now that you have chosen and downloaded your web proxy software, it’s time to configure your web server. This section covers both Nginx and Apache, as many users may have a preference for either.
Set Up Nginx Server Block
- Create a New Server Block
Create a new configuration file for your web proxy.
sudo nano /etc/nginx/sites-available/glype
- Add Configuration
Insert the following configuration into the file, adjusting the server_name to your domain or IP address.
server {
listen 80;
server_name your_domain_or_IP;
root /var/www/html/glype; # or /var/www/html/php-proxy for PHP-Proxy
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
- Enable the Server Block
Enable the newly created server block and test the configuration.
sudo ln -s /etc/nginx/sites-available/glype /etc/nginx/sites-enabled/
sudo nginx -t
- Restart Nginx
Restart the Nginx service to apply the changes.
sudo systemctl restart nginx
Configure Apache Virtual Host
If you prefer Apache over Nginx, here’s how to set it up:
- Create a New Virtual Host File
Create a new configuration file for your virtual host.
sudo nano /etc/apache2/sites-available/glype.conf
- Add Configuration
Insert the following configuration, adjusting the ServerName as needed.
<VirtualHost *:80>
ServerName your_domain_or_IP
DocumentRoot /var/www/html/glype # or /var/www/html/php-proxy for PHP-Proxy
<Directory /var/www/html/glype>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
- Enable the Virtual Host
Enable the new virtual host and the rewrite module.
sudo a2ensite glype.conf
sudo a2enmod rewrite
sudo systemctl restart apache2
Web Interface Setup
Once your web server is configured, you should test the web interface to ensure everything is working correctly. Open your browser and navigate to `http://your_domain_or_IP`. You should see the Glype or PHP-Proxy interface, confirming that your web proxy is up and running.
Step 4: Secure Your Web Proxy with Let’s Encrypt HTTPS
With your web proxy operational, securing it with HTTPS is crucial for protecting user data and privacy. Let’s Encrypt provides free SSL certificates that are easy to set up.
- Install Certbot
First, install Certbot and the Nginx or Apache plugin.
sudo apt install certbot python3-certbot-nginx # For Nginx
sudo apt install certbot python3-certbot-apache # For Apache
- Obtain SSL Certificate
Run the following command to obtain a certificate. Follow the prompts to complete the setup.
sudo certbot --nginx -d your_domain_or_IP # For Nginx
sudo certbot --apache -d your_domain_or_IP # For Apache
- Automate Certificate Renewal
Let’s Encrypt certificates expire every 90 days, so it’s important to set up automatic renewal. Add the following line to your crontab:
sudo crontab -e
Then, add the following line:
0 0 * * * /usr/bin/certbot renew --quiet
Final Thoughts
Setting up a web proxy on an Ubuntu 24.04 server is a valuable skill that can enhance your online privacy and security. By using a Linux VPS server, you can easily deploy powerful proxy solutions like Glype or PHP-Proxy. With the steps outlined above, you should be able to configure your server effectively and securely. Remember to keep your system updated and monitor it regularly for any potential issues.
Whether you are an individual looking to protect your browsing activity or a business aiming to provide secure access to your resources, setting up a web proxy is a practical solution that can adapt to your needs. Embrace the power of privacy and security today by implementing a web proxy on your Ubuntu 24.04 VPS!