Linux中squid服务的相关配置(VPN翻墙)

应用VPN进行翻墙

1.正向代理

一台可以上网的主机

yum install squid -y  ##下载squid
vim /etc/squid/squid.conf
 56 http_access allow all
 62 cache_dir ufs /var/spool/squid 100 16 256

在这里插入图片描述

systemctl restart squid

需要上网的客户机
打开浏览器–>Edit–>Preferences–>Advanced–>Network–>Settings–>Manual proxy configuration–>勾选Use this proxy server for all protocols–>HTTP Proxy:服务主机ip Port:3128–>ok

此时,客户机可以通过浏览器上网,但是不能ping 网址 。

2.反向代理:cdn(内容分发网络)

企业服务器(172.25.254.232)

yum install squid -y
vim /etc/squid/squid.conf
 56 http_access allow all
 59 http_port 80 vhost vport		##80接口提供虚拟http服务
 60 cache_peer 172.25.254.132 parent 80 0 proxy-only	##总服务器为132,端口为80,无备用服务器,只代理
 63 cache_dir ufs /var/spool/squid 100 16 256		##缓存地址,100M缓存

在这里插入图片描述
本地主机
https://172.25.254.232
出现172.25.254.132的内容

3.cdn集群

cdn服务器232

vim /etc/squid/squid.conf
 56 http_access allow all
 57 
 58 # Squid normally listens to port 3128
 59 http_port 80 vhost vport
 60 cache_peer 172.25.254.132 parent 80 0 proxy-only name=web1 originserver round-robin originserver weight=2
 61 cache_peer 172.25.254.133 parent 80 0 proxy-only name=web2 originserver round-robin originserver weight=2
 62 cache_peer_domain web1 web2 www.westos.com
 63 # Uncomment and adjust the following to add a disk cache directory.
 64 cache_dir ufs /var/spool/squid 100 16 256

在这里插入图片描述

systemctl restart squid

测试:
本地主机

vim /etc 
 3 172.25.254.232 www.westos.com news.westos.com music.westos.com login.westos.com /hosts

www.westos.com
在这里插入图片描述

部署论坛

cd /var/www/html/
unzip Discuz_X3.2_SC_UTF8.zip
cd upload/
chmod 777 -R config/
chmod 777 -R data/
chmod 777 -R uc_*

semanage fcontext -l | grep httpd
semanage fcontext -a -t httpd_sys_rw_content_t ‘/var/www/html/upload(/.*)?’
restorecon -FvvR /var/www/html/upload/
systemctl start mariadb
systemctl start httpd

进入firefox
安装论坛

猜你喜欢

转载自blog.csdn.net/qq_43511217/article/details/87865032