diff options
| author | Ruben Beltran del Rio <jj@r.bdr.sh> | 2026-04-30 15:17:30 +0200 |
|---|---|---|
| committer | Ruben Beltran del Rio <jj@r.bdr.sh> | 2026-04-30 15:37:23 +0200 |
| commit | 8cc11c52a88ec78d175b3ec8de854916f631caab (patch) | |
| tree | 4ad0bc1664a97418d0475b0b730c54d874953348 /extras/nginx.conf | |
Initial build
Diffstat (limited to 'extras/nginx.conf')
| -rw-r--r-- | extras/nginx.conf | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/extras/nginx.conf b/extras/nginx.conf new file mode 100644 index 0000000..0afc365 --- /dev/null +++ b/extras/nginx.conf @@ -0,0 +1,36 @@ +# Example nginx server block for estampa. +# +# estampa speaks CGI: when invoked with no arguments it reads +# DOCUMENT_ROOT and DOCUMENT_URI from the env (both populated by +# nginx's stock fastcgi_params) and serves the file at +# $document_root$document_uri as a syntax-highlighted HTML page. +# Files that aren't valid UTF-8 return 404. +# +# Pastes live under the `root` directory below; uploading via scp +# is enough to publish a new paste, and `estampa --run` is what +# expires them (see extras/estampa-ssh). +# +# Requires fcgiwrap (or any CGI-over-FastCGI gateway). + +server { + listen 80; + server_name paste.example.com; + + # Where pastes live. Change to taste. + # If this is also the home directory of an upload account (see + # README), the dotfile guard below is what keeps .ssh/ private. + root /srv/estampa; + + # Estampa only serves top-level, non-dotfile names. These rules + # short-circuit obvious misses so the CGI doesn't even fork. + location ~ /\. { return 404; } # dotfiles (.ssh/, .bashrc, ...) + location ~ /.+/ { return 404; } # anything inside a subdirectory + + location / { + fastcgi_pass unix:/run/fcgiwrap.socket; + include fastcgi_params; + + # No wrapper script needed: estampa with no args is the CGI mode. + fastcgi_param SCRIPT_FILENAME /usr/bin/estampa; + } +} |