Services:Step By Step: Difference between revisions
Appearance
Major update - troubleshooting guide: Step-by-Step Process for Adding Services (18 sections) |
Updated documentation from markdown files |
||
| Line 1: | Line 1: | ||
Follow these steps to | Follow these steps to expose a new service through the VPS reverse proxy (Caddy). | ||
== Step 1: | == Step 1: Add a Caddy site block == | ||
Edit <code>/etc/caddy/Caddyfile</code> and add a block for your hostname. | |||
'''VPS-local service''' (Docker on <code>127.0.0.1</code>): | |||
''' | |||
< | |||
<pre> | |||
newservice.jb-vpn.uk { | |||
reverse_proxy http://127.0.0.1:PORT { | |||
header_up Host {host} | |||
header_up X-Real-IP {remote} | |||
header_up X-Forwarded-For {remote} | |||
header_up X-Forwarded-Proto {scheme} | |||
} | |||
} | } | ||
</pre> | </pre> | ||
''' | '''NAS service''' (via OpenVPN at <code>10.8.0.2</code>): | ||
<pre> | |||
newservice.jb-vpn.uk { | |||
reverse_proxy http://10.8.0.2:PORT { | |||
header_up Host {host} | |||
header_up X-Real-IP {remote} | |||
header_up X-Forwarded-For {remote} | |||
header_up X-Forwarded-Proto {scheme} | |||
} | |||
} | |||
</pre> | </pre> | ||
'''NAS HTTPS backend''' (e.g. DSM-style): | |||
<pre> | <pre> | ||
newservice.jb-vpn.uk { | |||
reverse_proxy https://10.8.0.2:PORT { | |||
transport http { | |||
tls_insecure_skip_verify | |||
} | |||
header_up Host {host} | |||
header_up X-Forwarded-Proto {scheme} | |||
} | |||
} | |||
</pre> | </pre> | ||
Replace <code>PORT</code> with the internal port and ensure DNS points to the VPS. | |||
== Step 2: Validate and reload == | |||
<pre class="lang-bash"> | <pre class="lang-bash"> | ||
caddy validate --config /etc/caddy/Caddyfile | |||
systemctl reload caddy | |||
</pre> | </pre> | ||
== Step | == Step 3: Verify connectivity == | ||
<pre class="lang-bash"> | <pre class="lang-bash"> | ||
curl -I | nslookup newservice.jb-vpn.uk | ||
curl -I https://newservice.jb-vpn.uk | |||
</pre> | </pre> | ||
For NAS backends, confirm VPN first: | |||
<pre class="lang-bash"> | <pre class="lang-bash"> | ||
ping -c 2 10.8.0.2 | |||
curl -sI -m 5 http://10.8.0.2:PORT | head -1 | |||
</pre> | </pre> | ||
== Step 4: TLS == | |||
Caddy obtains and renews Let's Encrypt certificates automatically when: | |||
* | * DNS for the hostname points to <code>87.106.61.62</code> | ||
* | * Ports 80 and 443 are reachable on the VPS | ||
Check logs if HTTPS fails on first request: | |||
<pre class="lang-bash"> | <pre class="lang-bash"> | ||
journalctl -u caddy -n 50 | |||
</pre> | </pre> | ||
== Step 5: Browser test == | |||
Open <code>https://newservice.jb-vpn.uk</code> and confirm the service loads with a valid certificate. | |||
== Removing a service == | |||
# Remove the site block from <code>/etc/caddy/Caddyfile</code> | |||
# <code>caddy validate --config /etc/caddy/Caddyfile</code> | |||
# <code>systemctl reload caddy</code> | |||
== Related documentation == | |||
=== | |||
* [Prerequisites Prerequisites] | |||
* [ | * [Service Examples Service Examples] | ||
* [Configuration Options] | * [Configuration Options Configuration Options] | ||
* [ | * [[Services:Current Services]] | ||
[[Category:Documentation]] | [[Category:Documentation]] | ||
[[Category:Documentation/Services]] | [[Category:Documentation/Services]] | ||
[[Category:Documentation/Services/Adding Services]] | [[Category:Documentation/Services/Adding Services]] | ||
Latest revision as of 14:04, 16 May 2026
Follow these steps to expose a new service through the VPS reverse proxy (Caddy).
Step 1: Add a Caddy site block
[edit]Edit /etc/caddy/Caddyfile and add a block for your hostname.
VPS-local service (Docker on 127.0.0.1):
newservice.jb-vpn.uk {
reverse_proxy http://127.0.0.1:PORT {
header_up Host {host}
header_up X-Real-IP {remote}
header_up X-Forwarded-For {remote}
header_up X-Forwarded-Proto {scheme}
}
}
NAS service (via OpenVPN at 10.8.0.2):
newservice.jb-vpn.uk {
reverse_proxy http://10.8.0.2:PORT {
header_up Host {host}
header_up X-Real-IP {remote}
header_up X-Forwarded-For {remote}
header_up X-Forwarded-Proto {scheme}
}
}
NAS HTTPS backend (e.g. DSM-style):
newservice.jb-vpn.uk {
reverse_proxy https://10.8.0.2:PORT {
transport http {
tls_insecure_skip_verify
}
header_up Host {host}
header_up X-Forwarded-Proto {scheme}
}
}
Replace PORT with the internal port and ensure DNS points to the VPS.
Step 2: Validate and reload
[edit]caddy validate --config /etc/caddy/Caddyfile systemctl reload caddy
Step 3: Verify connectivity
[edit]nslookup newservice.jb-vpn.uk curl -I https://newservice.jb-vpn.uk
For NAS backends, confirm VPN first:
ping -c 2 10.8.0.2 curl -sI -m 5 http://10.8.0.2:PORT | head -1
Step 4: TLS
[edit]Caddy obtains and renews Let's Encrypt certificates automatically when:
- DNS for the hostname points to
87.106.61.62
- Ports 80 and 443 are reachable on the VPS
Check logs if HTTPS fails on first request:
journalctl -u caddy -n 50
Step 5: Browser test
[edit]Open https://newservice.jb-vpn.uk and confirm the service loads with a valid certificate.
Removing a service
[edit]- Remove the site block from
/etc/caddy/Caddyfile caddy validate --config /etc/caddy/Caddyfilesystemctl reload caddy
Related documentation
[edit]- [Prerequisites Prerequisites]
- [Service Examples Service Examples]
- [Configuration Options Configuration Options]