Linux与云计算——第二阶段 第一十一章:代理Proxy服务器架设—Squid代理服务器正向代理和客户端配置

Linux与云计算——第二阶段Linux服务器架设

第一十一章:代理Proxy服务器架设—Squid代理服务器正向代理和客户端配置

安装Squid

安装Squid配置代理服务器vim

[1] 这是一个通用的转发代理配置

[root@server ~]# yum -y install squid浏览器

[root@server ~]# vi /etc/squid/squid.conf服务器

# line 26: 添加一条ACLide

acl lan src 192.168.96.0/24ui

# line 54: 添加一条ACL云计算

http_access allow lanspa

# line 59: 修改代理

http_port 8080orm

# 在文件最后添加server

request_header_access Referer deny all

request_header_access X-Forwarded-For deny all

request_header_access Via deny all

request_header_access Cache-Control deny all

# specify hostname

visible_hostname server.example.com

# not display IP address

forwarded_for off

[root@server ~]# systemctl start squid

[root@server ~]# systemctl enable squid

配置Proxy 客户端

[1] 配置CentOS客户端

[root@client ~]# vim /etc/profile

# 在文件最后添加 (将代理配置成环境变量)

MY_PROXY_URL="http://server.example.com:8080/"

HTTP_PROXY=$MY_PROXY_URL

HTTPS_PROXY=$MY_PROXY_URL

FTP_PROXY=$MY_PROXY_URL

http_proxy=$MY_PROXY_URL

https_proxy=$MY_PROXY_URL

ftp_proxy=$MY_PROXY_URL

export HTTP_PROXY HTTPS_PROXY FTP_PROXY http_proxy https_proxy ftp_proxy

[root@client ~]# source /etc/profile

# 以上配置就完成了,可是不一样的应用可能还须要单独配置

# 针对YUM

[root@client ~]# vim /etc/yum.conf

# 最后添加

proxy=http://server.example.com:8080/

# 针对wget

[root@client ~]# vim /etc/wgetrc

# 最后添加

http_proxy = http://server.example.com:8080/

https_proxy = http://server.example.com:8080/

ftp_proxy = http://server.example.com:8080/

[2] 在火狐浏览器配置

相关文章
相关标签/搜索