Skip to content

Commit d2a4b1f

Browse files
committed
增加一片文章 搭建squid http proxy
1 parent 093b436 commit d2a4b1f

File tree

3 files changed

+48
-0
lines changed

3 files changed

+48
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
layout: post
3+
title: "Build your own Http Proxy via Squid(搭建Squid Http Proxy)"
4+
date: 2020-09-18
5+
desc: ""
6+
keywords: "proxy, firewall, httpproxy"
7+
categories: [Life]
8+
tags: [network,proxy]
9+
icon: icon-html
10+
---
11+
# 为什么要搭 http proxy?
12+
* 我的笔记本可以通过企业vpn 访问外网 但是我的手机需要通过我的电脑访问外网
13+
* 在客户现场, 我的笔记本可以访问外网,但是我的客户需要通过我的电脑访问外网
14+
15+
# Solution:
16+
> 我的环境是 Fedora 32
17+
## 安装 squid
18+
```bash
19+
sudo dnf install squid
20+
```
21+
## 增加三行配置到 /etc/squid/squid.conf
22+
```
23+
#configure upstream parent proxy
24+
cache_peer squid.xxx.xxx.xxx parent 3128 0 no-query default
25+
cache_peer_domain squid.xxx.xxx.xxx *
26+
never_direct allow all
27+
```
28+
此处squid.xxx.xxx.xxx是外部的http proxy. 也就是我本机安装的squid的上游 proxy.
29+
30+
所以,假设在局域网中Laptop ip为192.168.2.111, 以手机路由为例,是这样
31+
32+
手机浏览器 -> 192.168.2.111:3128 -> 上游squid 域名(squid.xxx.xxx.xxx):3128 -> 外网
33+
34+
# 测试
35+
可以通过Laptop 浏览器 配置本机127.0.0.1:3128 作为http proxy进行测试
36+
37+
# 配置手机
38+
以iphone为例
39+
40+
设置->无线网络
41+
42+
<img src="{{ site.img_path }}/blog/http-proxy/1.jpg" width="25%">
43+
<img src="{{ site.img_path }}/blog/http-proxy/2.jpg" width="25%">
44+
45+
46+
47+
48+
105 KB
Loading
78.6 KB
Loading

0 commit comments

Comments
 (0)