This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Nginx Proxy Settings

By: tcbarrett on Aug 14th, 2013  |  syntax: None  |  size: 1.24 KB  |  views: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. http {
  2.   # ... don't think these settings matter?
  3.  
  4.   server {
  5.     server_name www.my-site.com nonssl1.example.com nonssl2.example.com;
  6.  
  7.     location / {
  8.       proxy_pass http://upstream1;
  9.       proxy_set_header Host $http_host;
  10.       proxy_set_header X-Real-IP $remote_addr;
  11.       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  12.       proxy_next_upstream timeout;
  13.     }
  14.   }
  15.  
  16.   # THIS BLOCK SUCCEES FOR ALL SITES, TAKING OVER ALL REQUESTS
  17.   server {
  18.     listen      111.222.333.444:80;
  19.     server_name mysssl.example.com;
  20.  
  21.     location / {
  22.        rewrite ^(.*) https://mysssl.example.com$1 redirect;
  23.     }
  24.   }
  25.  
  26.   server {
  27.     listen       443;
  28.     server_name .example.com
  29.  
  30.     ssl on;
  31.     # ssl bits...
  32.     ssl_certificate /etc/nginx/ssl/example.com.crt;
  33.     ssl_certificate_key /etc/nginx/ssl/example.com.key;
  34.  
  35.     error_log  /var/log/nginx/ssl/example.com-error.log;
  36.     access_log /var/log/nginx/ssl/example.com-access.log;
  37.  
  38.     location / {
  39.       proxy_pass http://upstream1;
  40.       proxy_set_header X-IS-SSL yes;
  41.       proxy_set_header Host $http_host;
  42.       proxy_set_header X-Real-IP $remote_addr;
  43.       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  44.       proxy_next_upstream timeout;
  45.   }
  46. }
clone this paste RAW Paste Data