//nbkelley /homelab

Nginx vs Apache for Static Hosting

Nginx vs Apache for Static Hosting#

What Was Established#

A comparison of Nginx and Apache for the purpose of hosting static HTML/CSS/JS files within a Proxmox LXC or VM.

Key Decisions#

  • Choose Nginx if: You prioritize performance, low memory footprint, and plan to use it as a reverse proxy for modern stacks (Node.js, Python).
  • Choose Apache if: You require .htaccess support for per-directory configuration or are working with legacy PHP/LAMP stacks.

Current Configuration#

Nginx Basic Static Config#

server {
    listen 80;
    root /var/www/html;
    index index.html;
}

Apache Basic Static Config#

<VirtualHost *:80>
    DocumentRoot /var/www/html
    DirectoryIndex index.html
</VirtualHost>

Deployment Commands (LXC)#

To create a standard Ubuntu 22.04 LXC for web hosting:

Web Server Architecture on Proxmox

Web Server Architecture on Proxmox#

What Was Established#

High-level architectural strategies for deploying web development environments on Proxmox, focusing on balancing isolation with resource efficiency.

Key Decisions#

  • LXC for Services: Use LXC containers for lightweight, single-purpose services (e.g., Nginx, Databases) to minimize overhead.
  • VM for Complex Workloads: Use full VMs when running Docker, Kubernetes, or when custom kernel modules are required.
  • Reverse Proxy Pattern: Always use a reverse proxy (Nginx Proxy Manager, Traefik, or C/Caddy) to handle SSL termination and route traffic to multiple internal services.
  • Database Isolation: Separate databases into their own containers/VMs to improve security and facilitate independent backups.

Current Configuration#

Networking Patterns#

  • Bridge Mode: Default vmbr0 for services requiring LAN access.
  • Internal Network: Use secondary bridges (e.g., vmbr1) for isolated communication between web servers and databases.

Storage Patterns#

  • Local-LVM: Preferred for high-performance VM/container disks.
  • Directory Storage: Suitable for container volumes and simpler storage needs.

Historical Notes#

This architecture plan was established in March 2025. The preference for LXCs over VMs for simple web services was a primary driver.