summaryrefslogtreecommitdiffstats
path: root/nginx.conf
diff options
context:
space:
mode:
authorClaude <noreply@anthropic.com>2026-03-31 12:11:18 +0200
committerClaude <noreply@anthropic.com>2026-03-31 12:11:18 +0200
commit3cb7c82cf7c4e050148f69be23590a7fbe587a27 (patch)
treed2b6506db2de72b3a6982cfbe69925b88936de90 /nginx.conf
parent33f214f6cd9729473bb55fd7b3b923d5d960bb98 (diff)
downloadnebbet.no-3cb7c82cf7c4e050148f69be23590a7fbe587a27.tar.xz
nebbet.no-3cb7c82cf7c4e050148f69be23590a7fbe587a27.zip
Add static site builder: SQLite-backed MD→HTML pipeline
- cmd/nebbet: CLI with build [--watch] and user add/passwd/delete/list - internal/builder: markdown→HTML, component injection via HTML comments, auto importmap from lib/, fsnotify watch with 150ms debounce - internal/db: meta.db (page index, tag queries) + search.db (FTS5) - internal/sqlitedrv: minimal CGO database/sql driver for system libsqlite3 - internal/auth: htpasswd-compatible bcrypt password file management - templates/base.html + admin.html, styles/main.css + admin.css - nginx.conf with auth_basic for /admin, clean URLs, gzip - nebbet.service systemd unit for watch daemon - Example content/index.md and components/site-greeting.js https://claude.ai/code/session_01HTc1BCBCiMTEB54XQP1Wz9
Diffstat (limited to 'nginx.conf')
-rw-r--r--nginx.conf71
1 files changed, 71 insertions, 0 deletions
diff --git a/nginx.conf b/nginx.conf
new file mode 100644
index 0000000..715ac9a
--- /dev/null
+++ b/nginx.conf
@@ -0,0 +1,71 @@
+# nebbet.no nginx configuration
+# Adjust SITE_ROOT to the absolute path of your project directory.
+# Reload after changes: sudo nginx -s reload
+
+server {
+ listen 80;
+ listen [::]:80;
+ server_name nebbet.no www.nebbet.no;
+
+ # Redirect www → apex (optional, remove if not needed)
+ if ($host = www.nebbet.no) {
+ return 301 $scheme://nebbet.no$request_uri;
+ }
+
+ # ── static assets ────────────────────────────────────────────────────────
+ # Served directly from source so you don't have to copy them on every build.
+
+ location /styles/ {
+ alias SITE_ROOT/styles/;
+ expires 1d;
+ add_header Cache-Control "public";
+ }
+
+ location /components/ {
+ alias SITE_ROOT/components/;
+ expires 1d;
+ add_header Cache-Control "public";
+ }
+
+ location /lib/ {
+ alias SITE_ROOT/lib/;
+ expires 1d;
+ add_header Cache-Control "public";
+ }
+
+ # ── admin (password-protected) ───────────────────────────────────────────
+ location /admin/ {
+ auth_basic "Admin";
+ # The .passwords file is htpasswd-compatible (bcrypt).
+ # Manage with: nebbet user add <name>
+ auth_basic_user_file SITE_ROOT/.passwords;
+
+ root SITE_ROOT/public;
+ index index.html;
+ try_files $uri $uri.html $uri/index.html =404;
+ }
+
+ # ── public pages ─────────────────────────────────────────────────────────
+ location / {
+ root SITE_ROOT/public;
+ index index.html;
+
+ # Clean URLs: /about → /about.html
+ try_files $uri $uri.html $uri/index.html =404;
+
+ expires 1h;
+ add_header Cache-Control "public";
+ }
+
+ # ── 404 ──────────────────────────────────────────────────────────────────
+ error_page 404 /404.html;
+ location = /404.html {
+ root SITE_ROOT/public;
+ internal;
+ }
+
+ # ── gzip ─────────────────────────────────────────────────────────────────
+ gzip on;
+ gzip_types text/html text/css application/javascript application/json;
+ gzip_min_length 1024;
+}