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
.htaccesssupport 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: