---
title: "CentOS Linux VPS安装HTTP代理服务器Tinyproxy"
author: "powertech"
date: "2016-03-16T18:00:09Z"
tags: []
categories: ["开源软件"]
slug: "centos-linux-vps-http-tinyproxy"
draft: false
lastmod: "2016-03-16T17:59:59Z"
id: 2283630
url: "https://powertech.iteye.com/blog/2283630"
---

使用linux服务器作为http的代理，是一种比较简单快速的上网方式
或者把服务器配置为网关

以下为配置为http代理的方式

[原文](http://www.live-in.org/archives/710.html)

> 
> Tinyproxy是一个小型的基于GPL的HTTP/SSL代理程序，非常适合小型网络而且便于快速部署。这个代理程序最大的优点就是占用系统资源比较少。这里使用的系统为CentOS5.6，可以直接yum方式安装。
> 
> 安装epel源：
> 
>     rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm 
> 
> 安装Tinyproxy：
> 
>     yum update
>     yum install tinyproxy 
> 
> 编辑配置文件：
> 
>     vim /etc/tinyproxy/tinyproxy.conf 
> 
> 
> 修改Allow 127.0.0.1为自己IP，只允许自己使用，或者在Allow前面打#注释，允许任何IP都可以连接到Proxy：
> 
>     # Allow 127.0.0.1
>     # Allow 192.168.1.0/25 
> 
> 启动Tinyproxy服务，设置开机自启：
> 
>     service tinyproxy restart
>     chkconfig --level 345 tinyproxy on 
> 
> 相关文件位置：
> /etc/tinyproxy/tinyproxy.conf
> /var/run/tinyproxy/tinyproxy.pid
> /var/log/tinyproxy/tinyproxy.log
> 
> 将浏览器http代理设为这个代理的IP就能使用了，默认端口Port 8888。企业中可以通过路由器设置只允许代理服务器IP 80端口访问外网，通过强制代理方式限制只能够访问特定的网站。方法如下：
> 
>     vim /etc/tinyproxy/tinyproxy.conf 
> 
> 将以下三句注释去掉：
> 
>     Filter "/etc/tinyproxy/filter"
>     FilterURLs On
>     FilterDefaultDeny Yes 
> 
> 其它说明：
> Filter "/etc/tinyproxy/filter"
> 过滤配置文件的位置。
> FilterURLs On
> 过滤URL，默认过滤域名。域名过滤只检查域名段，URL过滤则检查整个URL。
> FilterExtended On
> 使用扩展POSIX正则表达式用于匹配过滤规则。默认是使用基本的POSIX正则表达式。
> FilterExtended On
> 使用区分大小写的正则表达式，默认不区分大小写。
> FilterDefaultDeny Yes
> 如果将该指令注释掉或设为No，过滤规则为禁止访问规则。默认为只允许访问过滤规则中的地址。
> 
> 编辑/etc/tinyproxy/filter：
> 
>     vim /etc/tinyproxy/filter 
> 
> 输入过滤规则内容(站点地址)，比如：
> 
>     163.com 
> 
> 重启Tinyproxy服务：
> 
>     service tinyproxy restart 
> 
> PS：此代理软件传输url和数据没有加密，不能用于翻---墙。
>