Last active
January 23, 2021 13:55
-
-
Save yoanisgil/d733e3227b55441c78f3bd53592c5852 to your computer and use it in GitHub Desktop.
Rancher SSL with compose
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upstream 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