Created
February 12, 2019 22:02
-
-
Save thomasloven/73c69649eda8a5c2fea2be73d20021ab to your computer and use it in GitHub Desktop.
nginx-ssl-proxy subdomains
This file contains 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
#################### | |
default.conf | |
#################### | |
map $http_upgrade $connection_upgrade { | |
default upgrade; | |
'' close; | |
} | |
server { | |
server_name _; | |
listen 80; | |
include /etc/nginx/conf.d/ssl-1.inc; | |
} | |
# Hemautomationsserver | |
server { | |
server_name hass.domännamn.se; | |
include /etc/nginx/conf.d/ssl-1.inc; | |
location / { | |
proxy_pass http://192.168.0.10:8123; | |
include /etc/nginx/conf.d/ssl-2.inc; | |
} | |
location /static/icons/ { | |
proxy_pass http://192.168.0.10:8123/local/icons/; | |
include /etc/nginx/conf.d/ssl-2.inc; | |
} | |
} | |
server { | |
server_name hass.domännamn.se; | |
include /etc/nginx/conf.d/ssl-redirect.inc; | |
} | |
# Mediaserver | |
server { | |
server_name plex.domännamn.se; | |
include /etc/nginx/conf.d/ssl-1.inc; | |
location / { | |
proxy_pass http://192.168.0.10:32400; | |
include /etc/nginx/conf.d/ssl-2.inc; | |
} | |
} | |
server { | |
server_name plex.domännamn.se; | |
include /etc/nginx/conf.d/ssl-redirect.inc; | |
} | |
# Portainer | |
server { | |
server_name portainer.domännamn.se; | |
listen 80; | |
location / { | |
proxy_pass http://192.168.0.10:9000; | |
allow 192.168.0.1/24; | |
deny all; | |
} | |
} | |
# Deconz | |
server { | |
server_name deconz.domännamn.se; | |
listen 80; | |
location / { | |
proxy_pass http://192.168.0.10:8082; | |
allow 192.168.0.1/24; | |
deny all; | |
} | |
} | |
# Proxmox | |
server { | |
server_name proxmox.domännamn.se; | |
listen 80; | |
location / { | |
proxy_pass http://192.168.0.10:8006; | |
allow 192.168.0.1/24; | |
deny all; | |
} | |
} | |
#################### | |
ssl-redirect.inc | |
#################### | |
listen 80; | |
location /.well-known/acme-challenge { | |
default_type "text/plain"; | |
root /usr/share/nginx/html; | |
try_files $uri =404; | |
} | |
location / { | |
return 301 https://$server_name$request_uri; | |
} | |
#################### | |
ssl-1.inc | |
#################### | |
listen 443 ssl; | |
ssl_certificate /etc/letsencrypt/fullchain-copy.pem; | |
ssl_certificate_key /etc/letsencrypt/privkey-copy.pem; | |
ssl_stapling on; | |
ssl_stapling_verify on; | |
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; | |
ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH"; | |
ssl_session_cache shared:SSL:1m; | |
ssl_session_timeout 5m; | |
location /.well-known/acme-challenge { | |
default_type "text/plain"; | |
root /usr/share/nginx/html; | |
try_files $uri =404; | |
} | |
#################### | |
ssl-1.inc | |
#################### | |
proxy_redirect http:// https://; | |
proxy_http_version 1.1; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection $connection_upgrade; | |
#################### | |
docker-compose.yml | |
#################### | |
version: "2.0" | |
services: | |
nginx: | |
container_name: nginx | |
image: danieldent/nginx-ssl-proxy | |
restart: always | |
environment: | |
SERVERNAME: domännamn.se | |
EXTRANAMES: hass.domännamn.se,plex.domännamn.se | |
ports: | |
- "80:80" | |
- "443:443" | |
volumes: | |
- /root/docker/nginx/letsencrypt:/etc/letsencrypt | |
- /root/docker/nginx/conf:/etc/nginx/conf.d |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment