squid 代理_Squid代理教程简介和示例

squid 代理

squid 代理

Proxy is an intermediate system that manages communication between two systems. In web applications, an HTTP proxy is mostly used type. The client makes a request to the proxy and then proxy makes the request to the server behalf of the client. So we may think that why we need an intermediary system for this communication.

代理服务器是管理两个系统之间通信的中间系统。 在Web应用程序中,HTTP代理是最常用的类型。 客户端向代理发出请求,然后代理代表客户端向服务器发出请求。 因此,我们可能会想到为什么我们需要一个中介系统来进行此通信。

This article is actually an introduction and there will be more articles looking for more details and implementation of the squid features. As you know HTTP is the protocol used to get web resources from servers. HTTP is developed the early 1990s by the CERN. And the HTTP protocol makes the web very powerful and overcrowded. Today there are billions of people use web especially HTTP web resources. As you know this high load is transmitted over networks like LAN, MAN, WAN. LAN’s are generally fast network because of the area and technologies used but MAN and especially WAN is more expensive than LAN. Home and enterprise users access to the web through WAN and consume a lot of network resources. These resources are generally the same for each user. So the same resource is consumed separately by each user and gets distinct network resources. For example, think of google.com. Google is a very popular portal for today and accessed more than once at the same time. If we cache the web resources Google sends to the client we can use the same resource cache for another client and there will be no need to request cached resources from Google. Here web proxies come to the scene. These proxies stay between client and server and accept request from clients and get theses to request from the server and then served to the client. After getting the resources web proxy caches than for further requests from the same or different client. And then if a client requests the same resources it answers the cached resources without going to the server. But keep in mind that there are a lot of mechanisms and configuration to make things work accordingly which we will look. But the simple workflow is this. Now let start

本文实际上是引言,将会有更多文章寻找鱿鱼功能的更多细节和实现。 如您所知,HTTP是用于从服务器获取Web资源的协议。 HTTP是CERN在1990年代初期开发的。 HTTP协议使网络变得非常强大和拥挤。 今天,有数十亿人使用Web,尤其是HTTP Web资源。 如您所知,这种高负载是通过LAN,MAN,WAN等网络传输的。 由于使用的区域和技术,LAN通常是快速网络,但是MAN(尤其是WAN)比LAN贵。 家庭和企业用户通过WAN访问Web并消耗大量网络资源。 对于每个用户,这些资源通常是相同的。 因此,每个用户分别消耗相同的资源,并获得不同的网络资源。 例如,以google.com为例。 Google是当今非常流行的门户网站,并且可以多次访问。 如果我们缓存Google发送给客户端的网络资源,则可以为另一个客户端使用相同的资源缓存,并且无需从Google请求缓存的资源。 Web代理出现在这里。 这些代理位于客户端和服务器之间,并接受来自客户端的请求,并从服务器获得这些请求,然后再提供给客户端。 获取资源后,Web代理将缓存来自相同或不同客户端的更多请求。 然后,如果客户端请求相同的资源,则无需访问服务器即可响应缓存的资源。 但是请记住,有许多机制和配置可以使事情相应地工作,我们将对此进行介绍。 但是简单的工作流程就是这样。 现在开始

LEARN MORE  How To Download and Install Kali Security and Penetration Test Linux Distribution?
了解更多信息如何下载和安装Kali Security and Penetration Test Linux发行版?

There is a lot of reasons for this. First one is content control where enterprise network owner wants to control the web access according to its access policy. The second one is to filter encrypted data so unwanted data streams can be avoided. On the other side, normal home internet users may want to bypass filters and blocks. Enterprises may want to improve web access performance by caching content in the proxy. The enterprise application may be accessed through a proxy in the enterprise LAN.

这有很多原因。 第一个是内容控制,企业网络所有者希望根据其访问策略来控制Web访问。 第二个是过滤加密的数据,以便避免不必要的数据流。 另一方面,普通的家庭互联网用户可能希望绕过过滤器和阻止。 企业可能希望通过在代理中缓存内容来提高Web访问性能。 可以通过企业LAN中的代理访问企业应用程序。

安装 (Install)

Here we can add more use scenarios but those are enough. Let start practice. Our proxy system is Ubuntu 14.10 x64. Firstly we install squid3 packets.

在这里,我们可以添加更多的使用场景,但是这些场景就足够了。 让我们开始练习。 我们的代理系统是Ubuntu 14.10 x64。 首先,我们安装squid3数据包。

Ubuntu,Debian,Mint,Kali (Ubuntu, Debian, Mint, Kali)

$ sudo apt-get install squid3
Install Squid3
Install Squid3
安装Squid3

And then start the squid service and look the status if there is an error.

然后启动鱿鱼服务,如果有错误,请查看状态。

Fedora,CentOS,RedHat (Fedora, CentOS, RedHat)

$ sudo yum install squid3

启动鱿鱼守护程序 (Start Squid Daemon)

We can start the Squid daemon named squid with the systemctl command like below. We will also provide the start for action.

我们可以使用systemctl命令启动名为squid的Squid守护程序,如下所示。 我们还将提供行动的起点。

$ sudo systemctl start squid

打印Squid3服务状态 (Print Squid3 Service Status)

We can check whether squid daemon or service work properly with the following command.

我们可以使用以下命令检查squid守护程序或服务是否正常工作。

$ sudo systemctl start squid3
Print Squid3 Service Status
Print Squid3 Service Status
打印Squid3服务状态

Go to the squid3 configuration directory. Here errorpage.css is the visual configuration of the error page which is shown to the user. msntauth.conf is a configuration for MS-based authentication. and squid.conf file which is the very long configuration file for squid but it can be divided into separate files and included into the main config file.

转到squid3配置目录。 这里errorpage.css是显示给用户的错误页面的直观配置。 msntauth.conf是基于MS的身份验证的配置。 和squid.conf文件,这是squid的很长的配置文件,但可以将其分为单独的文件并包含在主配置文件中。

$ cd /etc/squid3/ 
$ ls 
errorpage.css msntauth.conf squid.conf

启动Squid3 (Start Squid3)

In Ubuntu, squid3 binary resides /usr/sbin/squid3 and we can use it with parameters without a service command. For example, start squid with command

在Ubuntu中,squid3二进制文件位于/usr/sbin/squid3 ,我们可以在不使用service命令的情况下将其与参数一起使用。 例如,使用命令启动鱿鱼

$ /usr/sbin/squid3 -f /etc/squid3/squid.conf

打印Squid3版本和信息 (Print Squid3 Version and Information)

To see what is the compile options of the current binary and see supported futures and modules

要查看当前二进制文件的编译选项是什么,并查看受支持的期货和模块

$ /usr/sbin/squid3 -v

In order to log to the Syslog use this command and specify HTTP port explicitly

为了登录到系统日志,请使用此命令并显式指定HTTP端口

$ /usr/sbin/squid3 -s  -a 1234

After starting squid we look at processes related to squid. As you can see one process for daemon one process for worker and one process for logging

启动鱿鱼后,我们看一下与鱿鱼有关的过程。 如您所见,守护进程有一个进程,工作进程有一个进程,日志记录有一个进程

$ ps aux | grep squ
 

翻译自: https://www.poftut.com/introduction-to-squid-proxy-tutorial-with-examples/

squid 代理

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值