1 Case 1: Reverse proxy 1.1 Issues
By configuring a proxy server, you achieve the following goals:
-
A proxy server can cache a remote Web server page locally
-
Proxy server port set to 80 port
-
Users gain access to the page content on the remote Web server by accessing the proxy server
-
The remote Web server is transparent to the client user
-
Use caching mechanisms to improve Web site responsiveness
1.2 Solutions
Using 3 RHEL7 virtual machines, one of which is used as a SQUID proxy server to connect two network segments, you need to configure two network cards with addresses of 192.168.4.5 and 192.168.2.5 respectively. One as a client test host with an IP address of 192.168.4.100. A Web server with an address of 192.168.2.100, which provides a web data source for other agents, as shown in topology-1.
650) this.width=650; "Src=" http://pdf7.tarena.com.cn/tts8_source/ttsPage/LINUX/NSD_V05/OPERATION/DAY01/CASE/01/ Index.files/image001.png "alt=" Image001.png "/>
1.3 Steps
The implementation of this case needs to follow the steps below.
Step One: Build a Web server
1) Install the Web package with Yum
[Email protected] ~]# yum-y install httpd
[Email protected] ~]# rpm-q httpd
2) enable the HTTPD service and set it to run automatically
[Email protected] ~]# systemctl restart httpd; Systemctl Enable httpd
The HTTPD service listens for client requests via TCP 80 port by default:
[Email protected] ~]# NETSTAT-ANPTU | grep 80
TCP6 0 0::: $:::* LISTEN 4206/httpd
3) Create a test file for Web Access
Create a home page file named Index.html under the Web site root directory/var/www/html:
[Email protected] ~]# cat/var/www/html/index.html
<title>Welcome</title>
<body>
</body>
Step Two: Deploy Squid proxy Server
1) Install Squid package with Yum:
[Email protected] ~]# yum-y install squid
[Email protected] ~]# rpm-q squid
Squid-3.3.8-26.el7.x86_64
2) Modify the/etc/squid/squid.conf configuration file:
[Email protected] ~]# tail-5/etc/squid/squid.conf
Visible_hostname svr5.sumo.com
Cache_peer 192.168.2.100 Parent 0 Originserver
Cache_mem MB
Cache_dir Ufs/var/spool/squid 200 16 128
Http_access Allow all
3) Start the Squid service and set the boot to boot:
[Email protected] ~]# systemctl restart squid; Systemctl Enable Squid
4) Squid service listens for client requests via TCP 80 port:
[Email protected] ~]# NETSTAT-ANPTU | grep squid
TCP6 0 0::: +:::* LISTEN 3769/(squid-1)
Step Three: Client testing
Through the/etc/hosts file, configure the domain name resolution, resolves the domain name to the Squid server IP address
[Email protected] ~]# elinks--dump http://svr5.sumo.com
1176693506
This article is from the "Su Mo XI" blog, please make sure to keep this source http://linuxxd.blog.51cto.com/12849095/1921958
HTTP echo Proxy