//nbkelley /homelab

Web Server Stack (Nginx + Apache)#

What Was Established#

In this setup, Nginx is utilized as a high-performance reverse proxy to handle incoming traffic and static content, while Apache serves as the backend for dynamic content (e.g., PHP/WordPress) due to its flexible .htaccess support.

Key Decisions#

  • Architecture: Nginx acts as the entry point (Port 80/443) and proxies requests to Apache running on a non-standard port (e.g., 8080).
  • Rationale: Leverages Nginx’s superior concurrency and static content handling with Apache’s ease of use for per-directory configuration.

Current Configuration#

Apache Backend Configuration#

Modify /etc/apache2/ports.conf to listen on a different port to avoid conflict with Nginx:

Listen 8080

Nginx Reverse Proxy Configuration#

In the Nginx site configuration (e.g., /etc/nginx/sites-available/default), route traffic to the Apache backend:

server {
    listen 80;
    server_name your_domain.com;

    location / {
        proxy_pass http://localhost:8080;
    }
}

Service Management (Ubuntu)#

# Restarting services after config changes
sudo systemctl restart apache2
sudo systemctl restart nginx

Historical Notes#

This configuration assumes an Ubuntu-based environment. File paths like /etc/apache2/ and /var/www/html/ are standard for these versions as of 2025.

Open Questions#

  • Scaling the backend if multiple Apache instances are required.

Proxy Management & Cloudflare Tunnels, Nginx vs Apache for Static Hosting

Sources#

Apache vs Nginx: Key Differences Explained · ingested/chats/apache_vs_nginx_differences.md