Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Exemple de configuration d'un site nginx qui redirige vers un service web d'un container ou d'une VM
########################################################################
#
# 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
You can’t perform that action at this time.