Local Multi-Site Setup
The home server (outpost-pi, 192.168.68.54) runs Nginx + PHP 8.4 and serves multiple local websites, each with its own .lan domain.
How it works
- Each site gets its own Nginx virtual host with a unique
server_name(e.g.site1.lan) - Each site lives in its own directory under
/var/www/(e.g./var/www/site1.lan/) - Client devices resolve
.landomains via manual/etc/hostsentries — no local DNS server needed - The
defaultvhost remains as a catch-all, serving/var/www/for anything that doesn't match a specific site
Creating a new site
A helper script is installed at /usr/local/bin/newsite:
sudo newsite myproject
This:
- Creates
/var/www/myproject.lan/with a placeholderindex.html - Writes an Nginx vhost config to
/etc/nginx/sites-available/myproject.lan - Symlinks it into
sites-enabled - Tests the config and reloads Nginx
Vhost template
Each generated config looks like this:
server {
listen 80;
listen [::]:80;
server_name myproject.lan;
root /var/www/myproject.lan;
index index.php index.html;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.4-fpm.sock;
}
}
Client DNS setup
On each device that needs to access local sites, add entries to the hosts file pointing to the server:
Linux / Mac — /etc/hosts:
192.168.68.54 site1.lan
192.168.68.54 myproject.lan
Windows — C:\Windows\System32\drivers\etc\hosts:
192.168.68.54 site1.lan
192.168.68.54 myproject.lan
Then visit http://site1.lan in a browser.
Each new site requires a new hosts entry on every client device. If this becomes tedious, consider running dnsmasq on the server with
address=/lan/192.168.68.54to wildcard-resolve all.landomains, and pointing clients to the server as their DNS.