Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Http response agent

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Case 1: reverse proxy 1.1 issu

By configuring the proxy server, achieve the following goals:

The proxy server can cache remote Web server pages locally

The proxy server port is set to port 80

Users can access the page content on the remote Web server by accessing the proxy server.

The remote Web server is transparent to client users

Using caching mechanism to improve the response speed of the website

1.2 scenario

Use three RHEL7 virtual machines, one of which acts as a Squid proxy server, which is used to connect two network segments, so you need to configure two network cards with addresses 192.168.4.5 and 192.168.2.5, respectively. One is the client test host with the IP address of 192.168.4.100. A Web server at 192.168.2.100 that provides Web data sources for other agents, as shown in figure-1.

1.3 steps

To implement this case, you need to follow these steps.

Step 1: build a web server

1) install the web package using yum

[root@web ~] # yum-y install httpd

[root@web] # rpm-Q httpd

2) enable httpd service and set it to boot and run automatically

[root@web ~] # systemctl restart httpd; systemctl enable httpd

By default, the httpd service listens for client requests through TCP port 80:

[root@web ~] # netstat-anptu | grep 80

Tcp6 0 0: 80: * LISTEN 4206/httpd

3) create test files for Web access

Create a home file called index.html under the root directory / var/www/html of the website:

[root@web ~] # cat / var/www/html/index.html

Welcome

1176693506

Step 2: deploy the Squid proxy server

1) install the squid package using yum:

[root@squid ~] # yum-y install squid

[root@squid] # rpm-Q squid

Squid-3.3.8-26.el7.x86_64

2) modify / etc/squid/squid.conf configuration file:

[root@squid] # tail-5 / etc/squid/squid.conf

Visible_hostname svr5.sumo.com

Cache_peer 192.168.2.100 parent 80 0 originserver

Cache_mem 128 MB

Cache_dir ufs / var/spool/squid 200 16 128

Http_access allow all

3) start the squid service and set it to boot:

[root@squid ~] # systemctl restart squid; systemctl enable squid

4) squid service listens for client requests through TCP port 80:

[root@squid ~] # netstat-anptu | grep squid

Tcp6 0 0: 80: * LISTEN 3769 / (squid-1)

Step 3: client testing

Through the / etc/hosts file, configure domain name resolution to resolve the domain name to the Squid server IP address

[root@squid ~] # elinks-- dump http://svr5.sumo.com

1176693506

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report