Skip to content

Instantly share code, notes, and snippets.

@joerick
Created April 26, 2020 12:27
Show Gist options
  • Save joerick/4f01b995780858b45fbbf3dcbf88a22e to your computer and use it in GitHub Desktop.
Save joerick/4f01b995780858b45fbbf3dcbf88a22e to your computer and use it in GitHub Desktop.
device.li nginx config
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
upstream littleprinter {
server littleprinter.nordprojects.co:443;
}
server {
server_name device.li;
location / {
proxy_pass https://littleprinter/printkey/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host "littleprinter.nordprojects.co";
proxy_ssl_session_reuse off;
proxy_read_timeout 86400s;
}
location /static/ {
proxy_pass https://littleprinter/static/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host "littleprinter.nordprojects.co";
proxy_ssl_session_reuse off;
proxy_read_timeout 86400s;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/device.li/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/device.li/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = device.li) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name device.li;
return 404; # managed by Certbot
}
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
upstream heroku {
server nord-sirius.herokuapp.com:443;
}
upstream ngrok {
server 1d591c6f.ngrok.io:443;
}
server {
listen 80 default_server;
server_name littleprinter.nordprojects.co;
location / {
proxy_pass https://heroku;
# proxy_pass https://ngrok;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host "littleprinter.nordprojects.co";
# proxy_ssl_session_reuse off;
proxy_connect_timeout 10s;
proxy_read_timeout 60s;
# proxy_set_header Host "1d591c6f.ngrok.io";
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/littleprinter.nordprojects.co/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/littleprinter.nordprojects.co/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
root@little-printer-proxy:~#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment