Skip to content

Instantly share code, notes, and snippets.

@zhustec
Last active April 4, 2020 03:34
Show Gist options
  • Select an option

  • Save zhustec/f29d480acc917431e5ee170386e982ee to your computer and use it in GitHub Desktop.

Select an option

Save zhustec/f29d480acc917431e5ee170386e982ee to your computer and use it in GitHub Desktop.
Nginx jupyter
server {
listen 80;
server_name ****.*****.***;
location / {
proxy_pass http://localhost:8888;
proxy_set_header Host $host;
}
location ~ (/api/kernels/|/terminals/) {
proxy_pass http://localhost:8888;
proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_set_header Upgrade "websocket";
proxy_set_header Connection "Upgrade";
proxy_read_timeout 86400;
}
}
server {
listen 80;
server_name tools.******.***;
location /markdown {
# Attention: http:// is needed
proxy_pass http://unix:/tmp/****.sock:/markdown;
proxy_redirect off;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
listen 443 ssl;
if ($scheme != 'https') {
return 301 https://$host$request_uri;
}
include /etc/letsencrypt/options-ssl-nginx.conf;
# uncomment this too force ssl
# ssl on;
ssl_stapling on;
ssl_stapling_verify on;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
ssl_certificate /etc/letsencrypt/live/zhustec.me/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/zhustec.me/privkey.pem;
add_header Strict-Transport-Security "max-age=31536000" always;
add_header Content-Security-Policy "upgrade-insecure-requests";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment