This is a gallery website I built and decided to share as a public example.
web/: reverse proxy and watchdog examples for the public-facing hostapp/: Rust application source, templates, static files, database migrations, and host scripts
This example assumes two FreeBSD servers:
webapp
- FreeBSD
nginx- a public domain
- TLS certificates for that domain
- network access to the app server on port
8080 - optional Telegram bot token and chat id if you want alerting
- FreeBSD
- Rust toolchain with
cargo - a C toolchain such as
gccorclang pkg-config- PostgreSQL
- writable directories for:
uploads/uploads/thumbs/run/
You may be able to run this on another operating system if you can install equivalent packages there.
If you do that, you are responsible for adapting the differences yourself, including:
- service management
- package names
- filesystem paths
- OS-specific setup details
- Copy
app/root/.env.exampletoapp/root/.env. - Fill in your own admin usernames, password hashes, API key hashes, database URL, and IndexNow key.
- Create a PostgreSQL database.
- Start the app from
app/root/.
Example:
cd app/root
cargo run --releaseThe app listens on 0.0.0.0:8080 by default.
You can override that with BIND_ADDR and PORT.
- Open
web/nginx/nginx.conf. - Replace all
<...>placeholders with your own values. - Point the upstream to your app server address.
- Install the config into nginx.
- Reload or restart nginx.
The web/alerts/ and app/ops/alerts/ directories contain Telegram alert examples.
Replace the <...> placeholders before using them.
app/root/.env.exampleapp/root/Cargo.tomlapp/root/src/main.rsapp/root/migrations/web/nginx/nginx.confweb/alerts/
MIT, by itinfra7 from GitHub.