Skip to content

Instantly share code, notes, and snippets.

@kuleszaj
Created February 25, 2012 21:48
Show Gist options
  • Save kuleszaj/1911020 to your computer and use it in GitHub Desktop.
Save kuleszaj/1911020 to your computer and use it in GitHub Desktop.
Simple nginx load balancer and reverse proxy.
upstream rails_application {
server 10.0.0.1 max_fails=1 fail_timeout=10s;
server 10.0.0.2 max_fails=1 fail_timeout=10s;
# and so on: server 10.0.0.x;
}
upstream legacy_php_application {
server 10.0.1.1 max_fails=1 fail_timeout=10s;
}
server {
listen 1.2.3.4:80;
server_name railsapp.example.com;
location / {
proxy_pass http://rails_application;
}
}
server {
listen 1.2.3.4:80;
server_name phpapp.example.com;
location / {
proxy_pass http://legacy_php_application;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment