Squid+Apache

Squid Introduction

Proxy server is Proxy Server in English, and its role is to provide users with Web access acceleration by means of caching and to filter and control users' Web access. In short, it is to proxy users to obtain network resources.

Squid is a software used to cache internet data. When a user wants to download a homepage, he can send an application to Squid, ask Squid to download it instead, and then Squid accesses resources from other servers, and then pass the homepage to the user while keeping a backup, when other users apply On the same page, Squid immediately transfers the saved backup to the user, which makes the user feel very fast. Squid is equivalent to an agent.

Squid agent classification

Squid proxy can be divided into:
forward proxy: the client sends a data request, Squid retrieves the data from the server, and then sends the data to the client
reverse proxy: used to reduce the load of the web server

The two agents are briefly described below! ! !

  • Forward proxy
    Experimental environment:
    (client) rhel8_node1: 172.25.254.10 single network card (no Internet access)
    Insert picture description here
    (Squid proxy) rhel8_node2: 192.168.43.11 /172.25.254.33 dual network card (one ip can connect to a single network card host, one ip can communicate)
    Insert picture description here
    Steps:

Install Squid
dnf install squid -y in rhel8_node2
Insert picture description here

Edit Squid's configuration file vim /etc/squid/squid.conf
Insert picture description here

Restart the Squid service: systemctl restart squid
firewall-cmd--permanent--add-port = 3128 / tcp ## Add port 3128 to the firewall port list, so that the Squid program can run
firewall-cmd--reload ## refresh the firewall

Open the browser selection in the client rhel8_node1:
Insert picture description here
Insert picture description here
Insert picture description here
click OK! !

Then test:
first ping www.baidu.com in the client rhel8_node1 failed
Insert picture description here
, visit www.baidu.com in the browser successfully
Insert picture description here

The above Squid forward proxy is ready. The client fails to access Baidu. Squid software is installed in rhel8_node2 and acts as a proxy server, so that the client can successfully access Baidu through this proxy server.

  • Reverse proxy
    Experimental environment:
    rhel8_node1: 192.168.43.9 (Squid proxy server, no data is responsible for caching)
    rhel8_node2: 192.168.43.11 (Apache server)
    Operation steps:

Edit Squid's configuration file:
vim /etc/squid/squid.conf
Insert picture description here

Restart squid service
systemmctl restart squid

Insert picture description here
Last test, visit the Squid proxy server host ip: 192.168.43.9 in the browser, the results show information from the host 192.168.43.11
Insert picture description here

Published 35 original articles · praised 0 · visits 1416

Guess you like

Origin blog.csdn.net/qq_44749796/article/details/104808032