Skip to content

Instantly share code, notes, and snippets.

@phouverneyuff
Created March 13, 2017 19:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phouverneyuff/b4648485bfce92766f550145a188c2f9 to your computer and use it in GitHub Desktop.
Save phouverneyuff/b4648485bfce92766f550145a188c2f9 to your computer and use it in GitHub Desktop.
Rancher SSL with compose
version: '2'
services:
rancher:
image: rancher/server
container_name: rancher-server
restart: always
nginx:
image: nginx:1.11
volumes:
- /usr/local/etc/nginx/rancher.conf:/etc/nginx/conf.d/rancher.conf
- /usr/local/etc/nginx/ssl:/usr/local/etc/nginx/ssl
ports:
- "80:80/tcp"
- "443:443/tcp"
restart: always
pstream rancher {
server rancher-server:8080;
}
server {
listen 443 ssl;
server_name server_name;
ssl_certificate /usr/local/etc/nginx/ssl/server_name.crt;
ssl_certificate_key /usr/local/etc/nginx/ssl/server_name.key;
location / {
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://rancher;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
# This allows the ability for the execute shell window to remain open for up to 15 minutes. Without this parameter, the default is 1 minute and will automatically close.
proxy_read_timeout 900s;
}
}
server {
listen 80;
server_name server_name;
return 301 https://$server_name$request_uri;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment