/etc/systemd/system/octoprint.service
[Unit] Description=OctoPrint 3D Printer Manager After=network.target [Service] ExecStart=/home/octoprint/OctoPrint/venv/bin/octoprint Restart=on-failure User=octoprint Group=octoprint [Install] WantedBy=multi-user.target
/etc/systemd/system/octoprint-tunnel.service
[Unit] Description=Tunnel to public OctoPrint server After=network.target [Service] ExecStart=/usr/bin/ssh -N -R 5000:127.0.0.1:5000 octoprint.airwebreathe.org.uk Restart=on-failure User=octoprint Group=octoprint [Install] WantedBy=multi-user.target
/etc/nginx/sites-available/octoprint.airwebreathe.org.uk
proxy_cache_path /var/lib/nginx/cache/octoprint levels=1:2 keys_zone=octoprint:1m
max_size=128m inactive=10d use_temp_path=off;
server {
if ($scheme != "https") {
return 301 https://$host$request_uri;
}
ssl_stapling_verify on;
ssl_stapling on;
ssl_trusted_certificate /etc/letsencrypt/live/octoprint.airwebreathe.org.uk/chain.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_certificate_key /etc/letsencrypt/live/octoprint.airwebreathe.org.uk/privkey.pem;
ssl_certificate /etc/letsencrypt/live/octoprint.airwebreathe.org.uk/fullchain.pem;
error_log /var/lib/letsencrypt/error.log;
access_log /var/lib/letsencrypt/access.log;
listen 443 ssl;
listen 80;
listen [::]:80;
server_name octoprint.airwebreathe.org.uk;
autoindex off;
client_max_body_size 15M;
client_body_buffer_size 128k;
index index.html index.htm index.php doku.php;
access_log /var/log/nginx/octoprint.airwebreathe.org.uk/access.log;
error_log /var/log/nginx/octoprint.airwebreathe.org.uk/error.log;
location /sockjs/ {
proxy_pass http://127.0.0.1:5000/sockjs/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location / {
proxy_cache octoprint;
proxy_pass http://127.0.0.1:5000;
}
}