nginx reverse proxy, load balancing

What is a reverse proxy?

 User A -> B (and C in the same room, and a public network) -> C (without machine public network)

Under what scenario will use a reverse proxy?

1. Access network machines without public network

2. solve the communication problem between two handicapped

Edit virtual machine add network adapters, host-only mode, boot to increase the card

 

 Enter the card with files

# cd /etc/sysconfig/network-scripts/
# cp ifcfg-ens33 ifcfg-ens37
# vim ifcfg-ens37

 

Network Service Restart

# systemctl restart network

Windows can ping

 

 

 Scenes:

1.AB two machines, where only network A, B networks and the inner

2.A intranet network ip ip 192.168.109.133 B is the external network ip is 192.168.239.128 192.168.109.131

3.C client, C B can access the Internet can not be accessed in the network A or B

demand:

A 1.C To access to the intranet site

In the B machine configuration, the machine must be provided B nginx service:

server
{
    listen 80;
    server_name bbs.centos.com;

    location /
    {
        proxy_pass http://192.168.109.133;
        proxy_set_header Host   $host;
        proxy_set_header X-Real-IP      $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

Reset Configuration

# /usr/local/nginx/sbin/nginx -t
# /usr/local/nginx/sbin/nginx -s reload

 

Add port 80

# firewall-cmd --add-port=80/tcp --permanent
# firewall-cmd --reload

Adding Windows-hosts

Because there is no site on the B, A reverse proxy to the machine site

 

 

 

Guess you like

Origin www.cnblogs.com/yantou/p/11694343.html