Nginx 101 — Load-Balancer

https://assets.wp.nginx.com/wp-content/themes/nginx-theme/assets/img/logo.png
stream {    upstream myservers {
server 127.0.0.1:2222;
server 127.0.0.1:3333;
}
}
server {
listen 80;
proxy_pass myservers;
}
http {    
upstream myfirst {
server 127.0.0.1:7070;
server 127.0.0.1:7171;
}
server {
listen 8000;
location / {
proxy_pass http://myfirst;
}
}
} # http blockevents { } # events block
http {
upstream myfirst {
ip_hash;
server 127.0.0.1:7070;
server 127.0.0.1:7171;
}
server {
listen 8000;
location / {
proxy_pass http://myfirst;
}
}
} # http block
events { } # events block
server {
listen 192.168.1.2:443 ssl;
server_name 192.168.1.2;
location /mysite1/ {
proxy_pass http://192.168.1.2:8000/;
}
}server {
listen 192.168.1.2:443 ssl;
server_name 192.168.1.2;
ssl_certificate "/path/to/nginx.crt";
ssl_certificate_key "/path/to/private/nginx.key";
location /mysite2 {
proxy_pass http://192.168.1.2:9000/mysite2;
}

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store