Created
March 23, 2018 11:12
-
-
Save bzg/b607e2e3cad5d722c9d496aca9aa4acf to your computer and use it in GitHub Desktop.
Exemple de configuration d'un site nginx qui redirige vers un service web d'un container ou d'une VM
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
######################################################################## | |
# | |
# Exemple de configuration d'un sous-domaine eig-forever.org | |
# | |
# Le container ou la machine virtuelle est sur 192.168.0.102. | |
# Le service du container ou de la VM est sur le port 8000. | |
# Il sera exposé sur sousdomaine.eig-forever.org:80 et sur | |
# sousdomaine.eig-forever.org:443. | |
# Redirection 301 de http vers https | |
server { | |
listen 80; listen [::]:80; | |
server_name sousdomaine.eig-forever.org; | |
return 301 https://$host$request_uri; | |
} | |
server { | |
listen 443 ssl spdy; | |
server_name sousdomaine.eig-forever.org; | |
# Les certificats letsencrypt du serveur de calcul | |
ssl_certificate /etc/letsencrypt/live/eig-forever.org/fullchain.pem; | |
ssl_certificate_key /etc/letsencrypt/live/eig-forever.org/privkey.pem; | |
index index.html; | |
autoindex on; | |
log_not_found off; | |
access_log off; | |
location = /robots.txt { | |
allow all; | |
log_not_found off; | |
access_log off; | |
} | |
location / { | |
proxy_redirect off; | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_hide_header X-Frame-Options; | |
proxy_set_header X-Forwarded-Proto $scheme; | |
proxy_pass http://192.168.0.102:8000; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment