Why You Should Use Reverse Proxies on Alibaba Cloud

What Is a Reverse Proxy?

Why Use Reverse Proxies?

What Is a Load Balancer?

So What Is the Difference between Reverse Proxy and Load Balancer?

Tutorial: How to Set up a Reverse Proxy

wget http://nginx.org/packages/centos/7/x86_64/RPMS/nginx-1.14.2-1.el7_4.ngx.x86_64.rpm
rpm -ivh nginx-1.14.2-1.el7_4.ngx.x86_64.rpm
  • Now we would have to edit that configuration file of NGINX, in order to make the desired reverse proxy.
---------------------------------------------------------
#Configuration file
#Disable all logs
#Load balancing with sticky session enabled minimum one session
Upstream anynameofyourchoice {
#ip_hash;
keepalive 100;
server 10.1.244.35;
}
server {
listen 80;
listen [::]:80
server_name yourpublicwebsite.com
location /
{
proxy_pass http://anynameofyourchoice;
proxy_send_timeout 60m;
send_timeout 15m;
proxy_read_timeout 60m;
proxy_connect_timeout 60m;
client_max_body_size 0;
#enable websocket
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
---------------------------------------------------------------
server {
listen 80;
listen [::]:80
server_name yourpublicwebsite.com
location /
{
proxy_pass http://10.1.244.35;
}
}
  • Replace <yourpublicwebsite.com> with your own public domain
  • Replace <10.1.244.35> with your own backend server IP
  • sudo nginx
  • Sudo service nginx start
  • systemctl start nginx

Use Case

Scenario

Configuration file

#Configuration file 
#Disable all logs
#Load balancing with sticky session enabled minimum one session
Upstream qlikwebsocket {
#ip_hash;
keepalive 100;
server 10.14.14.24;
}
server {
listen 80;
listen [::]:80
server_name dashboard.com
location /global/
{
proxy_pass http://qlikwebsocket;
proxy_send_timeout 60m;
send_timeout 15m;
proxy_read_timeout 60m;
proxy_connect_timeout 60m;
client_max_body_size 0;
#enable websocket
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location /form/
{
proxy_set_header Host $http_host;
proxy_pass http:// 10.14.14.24:4244;
proxy_read_timeout 60m;
#enable websocket
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location /{
proxy_pass http:/ 10.13.13.23/;
}
}

Original Source

--

--

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
Alibaba Cloud

Alibaba Cloud

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website:https://www.alibabacloud.com