Guide: Nginx as Frontend, Apache2 as Backend on Debian LXDE
1. Update Your System
Open your terminal and update packages:
2. Install Apache2
Apache will act as the backend server that actually serves the content.
Verify Apache is running:
If it’s not running, start and enable it:
Test: Open your browser and go to
๐ http://localhost
You should see the Apache default page.
3. Change Apache Listening Port
Since Nginx will listen on port 80, Apache must use a different port (e.g., 8080).
Edit the ports configuration:
Change:
to:
Then edit the default Apache site config:
Find the line:
Change it to:
Save and restart Apache:
Test backend:
๐ Open http://localhost:8080
Apache should now be serving content on port 8080.
4. Install Nginx
Nginx will act as the frontend (reverse proxy).
Start and enable it:
5. Configure Nginx as Reverse Proxy
Create a new Nginx site config:
Add the following:
Save and enable the config:
Remove the default config if you don’t need it:
6. Test and Restart Services
Check Nginx configuration for syntax errors:
If everything is OK, restart Nginx:
7. Verify Setup
Now open your browser and visit:
๐ http://localhost
-
The request goes to Nginx (frontend) on port 80.
-
Nginx forwards it to Apache (backend) on port 8080.
-
You should see the Apache page delivered through Nginx.
8. (Optional) Firewall Adjustments
If you are running ufw, allow HTTP traffic:
✅ You now have Apache2 running as the backend and Nginx as the frontend reverse proxy on Debian LXDE.
Comments
Post a Comment