tinyauth-web/examples/nginx/subdomain-lan-only.conf

37 lines
1.1 KiB
Text

# tinyauth-web on a subdomain, reachable only from your LAN and VPN.
#
# This is the subdomain config plus an IP allowlist. Login through tinyauth is still
# required, so the allowlist is an extra layer, not a replacement.
# Replace the example ranges with your own. Test with `nginx -t`, then reload nginx.
server {
listen 443 ssl;
listen [::]:443 ssl;
http2 on;
server_name tinyauth-web.example.com;
ssl_certificate /etc/letsencrypt/live/tinyauth-web.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/tinyauth-web.example.com/privkey.pem;
allow 192.168.1.0/24; # LAN
allow 100.64.0.0/10; # Tailscale
allow 127.0.0.1;
deny all;
root /var/www/tinyauth-web/public;
index index.php;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/run/php/php8.4-fpm.sock; # match your PHP-FPM socket
}
location ~ /\. {
deny all;
}
}