Skip to content

Instantly share code, notes, and snippets.

@lguminski
Created March 31, 2014 17:08
Show Gist options
  • Save lguminski/9897067 to your computer and use it in GitHub Desktop.
Save lguminski/9897067 to your computer and use it in GitHub Desktop.
Nginx proxies
upstream quickbuild {
server quickbuild.company.com:8810;
}
server {
listen 80;
server_name server quickbuild.company.com;
access_log /var/log/nginx/quickbuild.access.log main;
error_log /var/log/nginx/quickbuild.error.log;
root /usr/share/nginx/html;
index index.html index.htm;
## send request back to quickbuild ##
location / {
proxy_pass http://quickbuild;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
proxy_redirect off;
proxy_buffering 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;
}
}
upstream quickbuild {
server quickbuild.company.com:8810;
}
limit_req_zone $binary_remote_addr zone=one:10m rate=2r/s;
server {
listen 80;
server_name server quickbuild.company.com;
access_log /var/log/nginx/quickbuild.access.log main;
error_log /var/log/nginx/quickbuild.error.log;
root /usr/share/nginx/html;
index index.html index.htm;
## send request back to quickbuild ##
location / {
proxy_pass http://quickbuild;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
proxy_redirect off;
proxy_buffering 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;
}
location /rest/ {
limit_req zone=one burst=5;
limit_rate_after 1k;
limit_rate 1k;
proxy_pass http://quickbuild;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
proxy_redirect off;
proxy_buffering 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;
access_log /var/log/nginx/quickbuild-rest.access.log main;
error_log /var/log/nginx/quickbuild-rest.error.log;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment