Skip to content

Instantly share code, notes, and snippets.

@kvudata
Created July 18, 2018 19:56
Show Gist options
  • Save kvudata/6caf6dd91f01d5d340e542aefdd97066 to your computer and use it in GitHub Desktop.
Save kvudata/6caf6dd91f01d5d340e542aefdd97066 to your computer and use it in GitHub Desktop.
Nginx reverse proxy config
server {
listen 80;
server_name localhost;
# error logs location when running nginx-debug
error_log /etc/nginx/logs/error.log debug;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
add_header Cache-Control "no-cache, must-revalidate";
}
location /api/ {
proxy_pass http://gunicorn:5000/;
# nginx by default makes http 1.0 requests when proxying, Istio requires >=1.1
proxy_http_version 1.1;
proxy_redirect http://gunicorn:5000/ /api/;
# setting the Host header is required for Istio,
# the Istio proxy expects the Host to be the destination service e.g. gunicorn[1]
#
# [1] https://groups.google.com/forum/#!topic/istio-users/H4sOD2wev3U
proxy_set_header Host gunicorn;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment