linux https代理squid搭建
来源:互联网 发布:高频交易算法 编辑:程序博客网 时间:2024/06/05 02:53
如何在linux上用squid搭建代理服务器_足够详细
在linux上用squid搭建代理服务器,这个东东全世界都是,但是有一些细节问题在网上说的不明不白的,折腾了半天搞好了,如鲠在喉不吐不快。
一台电脑linux系统,上不了网,于是在另外一台可以上网的linux上面搭建一个代理服务器,步骤如下:
下载:squid-3.2.9.tar.bz2
上传到服务器后解压:
解压: tar -vxjf squid-3.2.9.tar.bz2
解压后生成目录:squid-3.2.9
进入目录翻看文档INSTALL:
xxxx> more INSTALL
To build and install the Squid Cache, type:
% ./configure --prefix=/usr/local/squid
% make all
% make install
To run a Cache, you will need to:
1. customize the squid.conf configuration file:
% vi /usr/local/squid/etc/squid.conf
2. Initalise the cache:
% /usr/local/squid/sbin/squid -z
3. start the cache:
% /usr/local/squid/sbin/squid
If you want to use the WWW interface to the Cache Manager, copy
the cachemgr.cgi program into your httpd server's cgi-bin
directory.
安装步骤:
./configure --prefix=/usr/local/squid
make all
sudo make install(因为要拷贝到系统目录,需要root权限,所以sudo了,你也可以root登录执行,我是ubuntu的系统,所以用sudo,有root权限就行)
检查配置文件:
sudo vi /usr/local/squid/etc/squid.conf
配置项1:
# Squid normally listens to port 3128
http_port 3128
配置项2:
acl localnet src 192.168.0.0/16
http_access allow localnet
配置项3:
# Uncomment and adjust the following to add a disk cache directory.
cache_dir ufs /usr/local/squid/var/cache/squid 100 16 128
cache_mem 32 MB (这一条必须配置)
否则你就会遭遇报错: 2013/10/12 16:16:55 kid1| WARNING cache_mem is larger than total disk cache space!
安装好了以后,系统中新建了一个用户squid,在组中一查,发现属于nobody组的:
cat /etc/passwd|grep squid
cat /etc/group|grep 65534
安装squid的所在目录是:/usr/local/squid
我闲得没事干,直接改了所属用户为squid:nobody
sudo chown -Rf squid:nobody /usr/local/squid
建立cache的时候,对下面目录需要nobody用户权限,这个是网上没有说的很清楚的地方,折腾了我半天:
sudo chown -Rf nobody /usr/local/squid/var/cache/
sudo chown -Rf nobody /usr/local/squid/var/logs/
否则你会遭遇:
WARNING: Cannot write log file: /usr/local/squid/var/logs/cache.log
FATAL: Failed to make swap directory /usr/local/squid/var/cache/squid/00: (13) Permission denied
初始化squid.conf里配置的cache目录,就是建立了一堆的目录:
sudo /usr/local/squid/sbin/squid -z
在前台启动squid,并输出启动过程
sudo /usr/local/squid/sbin/squid -N -d1
显示ready to server reques,则启动成功。可以键入ctrl+c,停止squid,并以后台运行的方式启动。
我没有在配置文件中配置DNS,而是在 /etc/resolv.conf 中配置:
domain site
nameserver x.x.x.x
所以打印出来的日志中就这样的:
2013/10/12 16:42:13| Adding nameserver x.x.x.x from /etc/resolv.conf
squid从这个配置文件中读取了dns配置来用。
启动squid后台运行
sudo /usr/local/squid/sbin/squid -s
检查一下进程是否存在:ps -ef|grep squid
通过squid客户端查看squid运行状态
/usr/local/squid/bin/squidclient -h 127.0.0.1 -p 3128 mgr:info
那台不能上网的机器配置如下:
export http_proxy=http://192.168.199.235:3128/
可以把这句写到你的启动文件中,比如什么.profile或者.bashrc,或者/etc/profile等等。
取消:unset http_proxy
测试一下能不能上网了:
wget www.163.com
0 0
- linux https代理squid搭建
- 使用squid搭建https透明代理
- Squid 反向代理cdn搭建配置(支持https)
- Squid 搭建代理服务
- squid 启用https反向代理代理
- 使用Squid搭建HTTPS代理服务器
- Linux下squid搭建透明代理网关服务器
- Squid + iptables搭建透明代理
- Squid + iptables搭建透明代理
- 使用squid搭建http代理
- linux的squid代理服务
- linux初学者-squid代理篇
- 利用Squid搭建透明代理网关服务器
- Squid代理服务器&&搭建透明代理网关服务器
- squid透明代理纯文本搭建
- Squid 搭建正向代理详细解释
- Ubuntu12.04使用Squid搭建正向代理
- Linux搭建squid varnish 代理服务器
- J2ee方面最近总结
- 前段切图之ps使用技巧
- 项目记录05--客unity,服erlang--数据管理与工具
- TCP/IP的协议栈和帧格式
- 删除操作后续影响,操作
- linux https代理squid搭建
- java入门教程,return的用法!
- 1077. Kuchiguse
- 八种排序算法
- 怎样更改iMindMap字体
- iOS流布局UICollectionView系列六——将布局从平面应用到空间
- 【Python网络爬虫】百度贴吧/豆瓣小组
- android各个版本对应的api
- 为Android虚拟机创建SDCard