mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-12-04 21:59:58 -05:00
Replace nginx with Caddy for TLS termination and reverse proxying.
- Replace nginx with Caddy as the web server for both Docker and native (RPi/Debian) deployments. Caddy handles HTTPS termination, reverse proxying to all services (API, React app, Controller, Kiwix, Help, Map), and serves the media/download file browsers. - Generate a Root CA and signed leaf certificates for HTTPS. The Root CA uses Name Constraints to restrict signing to local addresses only (.local, localhost, and RFC 1918 private IP ranges), mitigating MITM risk if the CA key is compromised. - Add an HTTP landing page that guides users through one-time CA certificate installation on iOS, Android, macOS, Windows, Linux, and Firefox, with auto-redirect when the cert is already trusted. - Add trailing-slash redirects for /controller, /docs, /media, and /download so bare paths don't fall through to the React catch-all. - Add a Root CA download link on the Settings page under Configs. - Update help.sh diagnostics for IPv6 listener detection and HTTP/2 status codes. - Remove all nginx config files and the https_proxy Docker container. - Bump wrolpi-help submodule with certificate documentation.
This commit is contained in:
parent
dd270b37dc
commit
fbb71e012d
43 changed files with 881 additions and 583 deletions
|
|
@ -1,4 +1,4 @@
|
|||
<VirtualHost *:8084>
|
||||
<VirtualHost *:9084>
|
||||
# The ServerName directive sets the request scheme, hostname and port that
|
||||
# the server uses to identify itself. This is used when creating
|
||||
# redirection URLs. In the context of virtual hosts, the ServerName
|
||||
|
|
@ -19,10 +19,6 @@
|
|||
|
||||
DocumentRoot /var/www/html
|
||||
|
||||
SSLEngine on
|
||||
SSLCertificateFile /etc/nginx/cert.crt
|
||||
SSLCertificateKeyFile /etc/nginx/cert.key
|
||||
|
||||
Header set Access-Control-Allow-Origin "*"
|
||||
Header set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT"
|
||||
Header set Access-Control-Allow-Headers "Content-Type"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
<h1>Error!</h1>
|
||||
|
||||
<p>nginx could not find WROLPi! Are your services running?</p>
|
||||
<p>The web proxy could not find WROLPi! Are your services running?</p>
|
||||
|
||||
<p>Start by viewing status of your services at the
|
||||
<a id="controller_link" href="http://127.0.0.1:8087">Controller</a>
|
||||
|
|
|
|||
132
etc/raspberrypios/Caddyfile
Normal file
132
etc/raspberrypios/Caddyfile
Normal file
|
|
@ -0,0 +1,132 @@
|
|||
# Caddy config for WROLPi services (RPi/Debian bare metal).
|
||||
|
||||
{
|
||||
# No ACME - WROLPi is designed for offline use.
|
||||
auto_https disable_redirects
|
||||
}
|
||||
|
||||
:80 {
|
||||
handle / {
|
||||
root * /var/www
|
||||
rewrite * /landing.html
|
||||
file_server
|
||||
}
|
||||
handle /ca.crt {
|
||||
root * /media/wrolpi/config/ssl
|
||||
header Content-Type "application/x-x509-ca-cert"
|
||||
header Content-Disposition "attachment; filename=\"wrolpi-ca.crt\""
|
||||
file_server
|
||||
}
|
||||
handle {
|
||||
redir https://{host}{uri} permanent
|
||||
}
|
||||
}
|
||||
|
||||
:443 {
|
||||
tls /etc/ssl/wrolpi/cert.crt /etc/ssl/wrolpi/cert.key
|
||||
|
||||
header Access-Control-Allow-Origin "*"
|
||||
header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS"
|
||||
header Access-Control-Allow-Headers "Content-Type, Accept"
|
||||
|
||||
handle /favicon.ico {
|
||||
root * /opt/wrolpi
|
||||
rewrite * /icon.ico
|
||||
file_server
|
||||
}
|
||||
|
||||
handle /apple-touch-icon.png {
|
||||
root * /opt/wrolpi
|
||||
rewrite * /icon.png
|
||||
file_server
|
||||
}
|
||||
|
||||
# WebSocket for React dev server.
|
||||
handle /ws {
|
||||
reverse_proxy 0.0.0.0:3000
|
||||
}
|
||||
|
||||
# Controller - system management API and UI.
|
||||
handle_path /controller/* {
|
||||
reverse_proxy 0.0.0.0:8087
|
||||
}
|
||||
handle /controller {
|
||||
redir * /controller/ 301
|
||||
}
|
||||
|
||||
# Main API.
|
||||
handle /api/* {
|
||||
reverse_proxy 0.0.0.0:8081
|
||||
}
|
||||
|
||||
# API docs.
|
||||
handle /docs/* {
|
||||
reverse_proxy 0.0.0.0:8081
|
||||
}
|
||||
handle /docs {
|
||||
redir * /docs/ 301
|
||||
}
|
||||
|
||||
# Static media files with directory browsing.
|
||||
handle_path /media/* {
|
||||
root * /media/wrolpi
|
||||
file_server browse
|
||||
}
|
||||
handle /media {
|
||||
redir * /media/ 301
|
||||
}
|
||||
|
||||
# Downloads with Content-Disposition header.
|
||||
handle_path /download/* {
|
||||
root * /media/wrolpi
|
||||
header Content-Disposition "attachment"
|
||||
file_server browse
|
||||
}
|
||||
handle /download {
|
||||
redir * /download/ 301
|
||||
}
|
||||
|
||||
# React app with fallback to Controller.
|
||||
handle {
|
||||
reverse_proxy 0.0.0.0:3000 {
|
||||
@bad status 502 503 504
|
||||
handle_response @bad {
|
||||
header Location /controller/?fallback=true
|
||||
respond "" 302
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
handle_errors {
|
||||
header Access-Control-Allow-Origin "*"
|
||||
header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS"
|
||||
header Access-Control-Allow-Headers "Content-Type, Accept"
|
||||
root * /var/www
|
||||
rewrite * /50x.html
|
||||
file_server
|
||||
}
|
||||
}
|
||||
|
||||
# Kiwix HTTPS proxy.
|
||||
:8085 {
|
||||
tls /etc/ssl/wrolpi/cert.crt /etc/ssl/wrolpi/cert.key
|
||||
header ?Access-Control-Allow-Origin "*"
|
||||
header ?Access-Control-Allow-Methods "GET, OPTIONS"
|
||||
reverse_proxy 0.0.0.0:9085
|
||||
}
|
||||
|
||||
# Help HTTPS proxy.
|
||||
:8086 {
|
||||
tls /etc/ssl/wrolpi/cert.crt /etc/ssl/wrolpi/cert.key
|
||||
header ?Access-Control-Allow-Origin "*"
|
||||
header ?Access-Control-Allow-Methods "GET, OPTIONS"
|
||||
reverse_proxy 0.0.0.0:9086
|
||||
}
|
||||
|
||||
# Map HTTPS proxy (Apache2 HTTP-only on 9084).
|
||||
:8084 {
|
||||
tls /etc/ssl/wrolpi/cert.crt /etc/ssl/wrolpi/cert.key
|
||||
header ?Access-Control-Allow-Origin "*"
|
||||
header ?Access-Control-Allow-Methods "GET, OPTIONS"
|
||||
reverse_proxy 0.0.0.0:9084
|
||||
}
|
||||
174
etc/raspberrypios/landing.html
Normal file
174
etc/raspberrypios/landing.html
Normal file
|
|
@ -0,0 +1,174 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Welcome to WROLPi</title>
|
||||
<style>
|
||||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
||||
background: #1a1a2e; color: #eee; min-height: 100vh;
|
||||
display: flex; justify-content: center; padding: 2rem 1rem;
|
||||
}
|
||||
.container { max-width: 640px; width: 100%; }
|
||||
h1 { font-size: 2rem; margin-bottom: 0.5rem; color: #fff; }
|
||||
.subtitle { color: #aaa; margin-bottom: 2rem; }
|
||||
.card {
|
||||
background: #16213e; border-radius: 12px; padding: 1.5rem;
|
||||
margin-bottom: 1.5rem; border: 1px solid #1a3a5c;
|
||||
}
|
||||
.card h2 { font-size: 1.1rem; margin-bottom: 0.75rem; color: #4cc9f0; }
|
||||
.card p { line-height: 1.6; color: #ccc; margin-bottom: 1rem; }
|
||||
.btn {
|
||||
display: inline-block; padding: 0.75rem 1.5rem; border-radius: 8px;
|
||||
text-decoration: none; font-weight: 600; font-size: 1rem;
|
||||
cursor: pointer; border: none; text-align: center;
|
||||
}
|
||||
.btn-primary { background: #4cc9f0; color: #1a1a2e; }
|
||||
.btn-primary:hover { background: #3ab8df; }
|
||||
.btn-continue { background: #2ecc71; color: #fff; width: 100%; font-size: 1.1rem; }
|
||||
.btn-continue:hover { background: #27ae60; }
|
||||
details { margin-bottom: 0.75rem; }
|
||||
summary {
|
||||
cursor: pointer; padding: 0.5rem 0; font-weight: 600;
|
||||
color: #4cc9f0; list-style: none;
|
||||
}
|
||||
summary::before { content: "\25b6\00a0"; font-size: 0.8rem; }
|
||||
details[open] > summary::before { content: "\25bc\00a0"; }
|
||||
.instructions { padding: 0.75rem 0 0.25rem 0.5rem; color: #bbb; line-height: 1.7; }
|
||||
.instructions ol { padding-left: 1.25rem; }
|
||||
.instructions li { margin-bottom: 0.3rem; }
|
||||
code { background: #0f3460; padding: 0.15rem 0.4rem; border-radius: 4px; font-size: 0.9em; }
|
||||
#auto-redirect { display: none; text-align: center; color: #2ecc71; margin-bottom: 1rem; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>Welcome to WROLPi</h1>
|
||||
<p class="subtitle">Your offline library needs a one-time certificate setup.</p>
|
||||
|
||||
<div id="auto-redirect" class="card">
|
||||
<p>Certificate already trusted! Redirecting...</p>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<h2>Step 1: Download the Root CA Certificate</h2>
|
||||
<p>Install this certificate on your device to trust all WROLPi HTTPS services permanently.</p>
|
||||
<a class="btn btn-primary" href="/ca.crt" download="wrolpi-ca.crt">Download WROLPi Root CA</a>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<h2>Step 2: Trust the Certificate</h2>
|
||||
<p>Follow the instructions for your device:</p>
|
||||
|
||||
<details>
|
||||
<summary>iOS / iPadOS</summary>
|
||||
<div class="instructions">
|
||||
<ol>
|
||||
<li>Tap the download button above, then tap <strong>Allow</strong> when prompted.</li>
|
||||
<li>Open <strong>Settings</strong> → <strong>General</strong> → <strong>VPN & Device Management</strong>.</li>
|
||||
<li>Tap <strong>WROLPi Root CA</strong> → <strong>Install</strong> → enter your passcode.</li>
|
||||
<li>Go to <strong>Settings</strong> → <strong>General</strong> → <strong>About</strong> → <strong>Certificate Trust Settings</strong>.</li>
|
||||
<li>Enable full trust for <strong>WROLPi Root CA</strong>.</li>
|
||||
</ol>
|
||||
</div>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Android</summary>
|
||||
<div class="instructions">
|
||||
<ol>
|
||||
<li>Tap the download button above.</li>
|
||||
<li>Open <strong>Settings</strong> → <strong>Security & privacy</strong> → <strong>More security settings</strong> → <strong>Encryption & credentials</strong> → <strong>Install a certificate</strong> → <strong>CA certificate</strong>.</li>
|
||||
<li>Select the downloaded <code>wrolpi-ca.crt</code> file and confirm.</li>
|
||||
</ol>
|
||||
<p style="margin-top:0.5rem;font-size:0.9em;color:#999;">Menu paths vary by manufacturer. If you can't find it, search for <em>"certificate"</em> in Settings.</p>
|
||||
</div>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>macOS</summary>
|
||||
<div class="instructions">
|
||||
<ol>
|
||||
<li>Double-click the downloaded <code>wrolpi-ca.crt</code> file to open Keychain Access.</li>
|
||||
<li>Add it to the <strong>System</strong> or <strong>login</strong> keychain.</li>
|
||||
<li>Find <strong>WROLPi Root CA</strong> in the keychain, double-click it.</li>
|
||||
<li>Expand <strong>Trust</strong>, set <em>When using this certificate</em> to <strong>Always Trust</strong>.</li>
|
||||
<li>Close and enter your password to confirm.</li>
|
||||
</ol>
|
||||
</div>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Windows</summary>
|
||||
<div class="instructions">
|
||||
<ol>
|
||||
<li>Double-click the downloaded <code>wrolpi-ca.crt</code> file.</li>
|
||||
<li>Click <strong>Install Certificate</strong> → <strong>Local Machine</strong> → <strong>Next</strong>.</li>
|
||||
<li>Select <strong>Place all certificates in the following store</strong> → <strong>Browse</strong> → <strong>Trusted Root Certification Authorities</strong>.</li>
|
||||
<li>Click <strong>Finish</strong>.</li>
|
||||
</ol>
|
||||
</div>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Linux (Debian / Ubuntu)</summary>
|
||||
<div class="instructions">
|
||||
<ol>
|
||||
<li>Copy the certificate (the <code>.crt</code> extension is required): <code>sudo cp wrolpi-ca.crt /usr/local/share/ca-certificates/</code></li>
|
||||
<li>Update the trust store: <code>sudo update-ca-certificates</code></li>
|
||||
<li>Restart your browser. Chromium-based browsers (Chrome, Edge) will use the system store automatically.</li>
|
||||
</ol>
|
||||
<p style="margin-top:0.5rem;font-size:0.9em;color:#999;">Firefox on Linux does <em>not</em> use the system trust store by default — see the Firefox section below.</p>
|
||||
</div>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Firefox (all platforms)</summary>
|
||||
<div class="instructions">
|
||||
<p style="margin-bottom:0.5rem;">Since Firefox 120, Firefox <strong>automatically trusts</strong> root certificates installed in the OS certificate store on <strong>Windows, macOS, and Android</strong>. If you've already installed the certificate above, Firefox should work with no extra steps on those platforms.</p>
|
||||
<p style="margin-bottom:0.5rem;">On <strong>Linux</strong> (or if auto-trust is disabled), import manually:</p>
|
||||
<ol>
|
||||
<li>Open Firefox, go to <strong>Settings</strong> → <strong>Privacy & Security</strong>.</li>
|
||||
<li>Scroll to <strong>Certificates</strong> → click <strong>View Certificates</strong>.</li>
|
||||
<li>In the <strong>Authorities</strong> tab, click <strong>Import</strong>.</li>
|
||||
<li>Select the downloaded <code>wrolpi-ca.crt</code> file.</li>
|
||||
<li>Check <strong>Trust this CA to identify websites</strong> → <strong>OK</strong>.</li>
|
||||
</ol>
|
||||
<p style="margin-top:0.5rem;font-size:0.9em;color:#999;">Alternatively, enable auto-trust: go to <code>about:config</code> and set <code>security.enterprise_roots.enabled</code> to <code>true</code>.</p>
|
||||
</div>
|
||||
</details>
|
||||
</div>
|
||||
|
||||
<div class="card" style="text-align:center;">
|
||||
<a class="btn btn-continue" id="continue-btn" href="#">Continue to WROLPi</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
(function() {
|
||||
var host = window.location.hostname;
|
||||
var port = window.location.port;
|
||||
// Docker maps HTTP 8080 → HTTPS 8443; native uses default 443.
|
||||
var httpsPort = (port === '8080') ? ':8443' : '';
|
||||
var httpsBase = 'https://' + host + httpsPort;
|
||||
|
||||
document.getElementById('continue-btn').href = httpsBase;
|
||||
|
||||
// Auto-redirect if cert is already trusted.
|
||||
var controller = new AbortController();
|
||||
var timeout = setTimeout(function() { controller.abort(); }, 3000);
|
||||
fetch(httpsBase + '/api/echo', { signal: controller.signal })
|
||||
.then(function(r) {
|
||||
if (r.ok) {
|
||||
document.getElementById('auto-redirect').style.display = 'block';
|
||||
setTimeout(function() { window.location.href = httpsBase; }, 1500);
|
||||
}
|
||||
})
|
||||
.catch(function() {})
|
||||
.finally(function() { clearTimeout(timeout); });
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,101 +0,0 @@
|
|||
user www-data;
|
||||
|
||||
events {
|
||||
|
||||
}
|
||||
|
||||
http {
|
||||
client_max_body_size 0;
|
||||
|
||||
map $http_upgrade $connection_upgrade {
|
||||
default upgrade;
|
||||
'' close;
|
||||
}
|
||||
charset utf-8;
|
||||
|
||||
include mime.types;
|
||||
types {
|
||||
# Custom types for ebooks.
|
||||
application/x-mobipocket-ebook mobi;
|
||||
application/epub+zip epub;
|
||||
# Configs
|
||||
text/yaml yaml yml;
|
||||
}
|
||||
|
||||
error_page 502 /error/50x.html;
|
||||
error_page 503 /error/50x.html;
|
||||
error_page 504 /error/50x.html;
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name _; # Default server for requests without "Host" header
|
||||
|
||||
location / {
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
listen [::]:443 ssl;
|
||||
proxy_pass_header Host;
|
||||
|
||||
# Self-signed cert.
|
||||
ssl_certificate /etc/nginx/cert.crt;
|
||||
ssl_certificate_key /etc/nginx/cert.key;
|
||||
|
||||
# CORS headers for Controller direct access (http://host:8087 -> https://host/api)
|
||||
# Added at server level so they apply to error pages (502, etc.)
|
||||
add_header 'Access-Control-Allow-Origin' '*' always;
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always;
|
||||
add_header 'Access-Control-Allow-Headers' 'Content-Type, Accept' always;
|
||||
|
||||
# Override http-level error_page to use named location with CORS
|
||||
error_page 502 503 504 @error_with_cors;
|
||||
|
||||
location @error_with_cors {
|
||||
add_header 'Access-Control-Allow-Origin' '*' always;
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always;
|
||||
add_header 'Access-Control-Allow-Headers' 'Content-Type, Accept' always;
|
||||
root /var/www;
|
||||
try_files /50x.html =502;
|
||||
}
|
||||
|
||||
include /etc/nginx/conf.d/*;
|
||||
}
|
||||
|
||||
# HTTPS Map is served by Apache2. This is because mod_tile.conf is required to render the map. renderd does not
|
||||
# support nginx.
|
||||
|
||||
server {
|
||||
# HTTPS Kiwix.
|
||||
listen 8085 ssl;
|
||||
listen [::]:8085 ssl;
|
||||
proxy_pass_header Host;
|
||||
proxy_set_header 'Access-Control-Allow-Origin' '*';
|
||||
|
||||
ssl_certificate /etc/nginx/cert.crt;
|
||||
ssl_certificate_key /etc/nginx/cert.key;
|
||||
|
||||
location / {
|
||||
proxy_pass http://0.0.0.0:9085;
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
# HTTPS Help.
|
||||
listen 8086 ssl;
|
||||
listen [::]:8086 ssl;
|
||||
proxy_pass_header Host;
|
||||
add_header 'Access-Control-Allow-Origin' '*';
|
||||
|
||||
ssl_certificate /etc/nginx/cert.crt;
|
||||
ssl_certificate_key /etc/nginx/cert.key;
|
||||
|
||||
location / {
|
||||
proxy_pass http://0.0.0.0:9086;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1 +1 @@
|
|||
Listen 8084
|
||||
Listen 9084
|
||||
8
etc/raspberrypios/wrolpi-cert-renew.service
Normal file
8
etc/raspberrypios/wrolpi-cert-renew.service
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
[Unit]
|
||||
Description=Renew WROLPi TLS certificates if expiring soon
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/opt/wrolpi/scripts/renew_certificates.sh
|
||||
StandardOutput=journal
|
||||
10
etc/raspberrypios/wrolpi-cert-renew.timer
Normal file
10
etc/raspberrypios/wrolpi-cert-renew.timer
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
[Unit]
|
||||
Description=Weekly check for WROLPi TLS certificate renewal
|
||||
|
||||
[Timer]
|
||||
OnCalendar=weekly
|
||||
Persistent=true
|
||||
RandomizedDelaySec=3600
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
||||
|
|
@ -1,100 +0,0 @@
|
|||
# Nginx config for the WROLPi services.
|
||||
|
||||
#
|
||||
# Error pages
|
||||
#
|
||||
|
||||
location /error/ {
|
||||
alias /var/www/;
|
||||
internal;
|
||||
}
|
||||
|
||||
#
|
||||
# App
|
||||
#
|
||||
|
||||
location /favicon.ico {
|
||||
alias /opt/wrolpi/icon.ico;
|
||||
}
|
||||
|
||||
location /apple-touch-icon.png {
|
||||
alias /opt/wrolpi/icon.png;
|
||||
}
|
||||
|
||||
location / {
|
||||
# React APP with Controller fallback
|
||||
proxy_pass http://0.0.0.0:3000;
|
||||
proxy_intercept_errors on;
|
||||
error_page 502 503 504 = @react_fallback;
|
||||
rewrite $1 break;
|
||||
}
|
||||
|
||||
location @react_fallback {
|
||||
return 302 /controller/?fallback=true;
|
||||
}
|
||||
|
||||
location /ws {
|
||||
proxy_pass http://0.0.0.0:3000;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
}
|
||||
|
||||
#
|
||||
# Controller - system management API and UI
|
||||
# All Controller endpoints are under /controller/*
|
||||
#
|
||||
location /controller {
|
||||
rewrite ^/controller(.*)$ $1 break;
|
||||
proxy_pass http://0.0.0.0:8087;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
}
|
||||
|
||||
#
|
||||
# Main API - handled by the API service (port 8081)
|
||||
#
|
||||
|
||||
location /api {
|
||||
proxy_pass http://0.0.0.0:8081;
|
||||
rewrite /^api(.*)$ $1 break;
|
||||
}
|
||||
|
||||
location /docs {
|
||||
proxy_pass http://0.0.0.0:8081;
|
||||
rewrite /^docs(.*)$ $1 break;
|
||||
}
|
||||
|
||||
location /media {
|
||||
# The media files mounted in the docker volume
|
||||
sendfile on;
|
||||
sendfile_max_chunk 1m;
|
||||
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
keepalive_timeout 65;
|
||||
|
||||
autoindex on;
|
||||
autoindex_exact_size off;
|
||||
alias /media/wrolpi;
|
||||
}
|
||||
|
||||
location /download {
|
||||
# Assume any request here is to download a file from the media directory.
|
||||
if ( $request_filename ~ '^.*/(.+)$' ) {
|
||||
# Always include the filename for downloads.
|
||||
add_header Content-Disposition 'attachment; filename="$1"';
|
||||
}
|
||||
|
||||
sendfile on;
|
||||
sendfile_max_chunk 1m;
|
||||
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
keepalive_timeout 65;
|
||||
|
||||
autoindex on;
|
||||
autoindex_exact_size off;
|
||||
alias /media/wrolpi;
|
||||
}
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
[Unit]
|
||||
Description=WROLPi services group
|
||||
Wants=wrolpi-controller.service wrolpi-api.service wrolpi-app.service nginx.service postgresql.service wrolpi-kiwix.service renderd.service apache2.service postgresql@15-map.service
|
||||
Wants=wrolpi-controller.service wrolpi-api.service wrolpi-app.service caddy.service postgresql.service wrolpi-kiwix.service renderd.service apache2.service postgresql@15-map.service
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue