Build and configure squid Proxy Server and squid Proxy Server

Source: Internet
Author: User
Tags squid proxy

Build and configure squid Proxy Server and squid Proxy Server

System Environment: CentOS release 6.5 (Final) (minimal installation)

1. Install squid

# Yum-y install squid

2. Edit the configuration file (Forward proxy)

# Vim/etc/squid. conf

Add the following content:

Cache_dir ufs/var/spool/squid 1000 16 256

Cache_mem 128 MB

Refresh_pattern \. (jpg | png | gif | js | css | mp3 | mp4) 1440 20% 2880 ignore-reload

Visible_hostname rhel

Start squid service

#/Etc/init. d/squid start

Test whether the configuration is successful first in the browser:

Configure Internet Options, connections, LAN Settings, and proxy servers in the browser. Enter ip Address: 10.10.162 and port: 3128.

Use tcpdump on the squid side to check whether the squid configuration has taken effect. If a large number of data flow packets are generated, it indicates that the squid configuration is successful.

# Tcpdump-nn port 3128

Use curl for testing:

# Curl-x127.0.0.1: 3128 www.aminglinux.com-I

3. Restrict Website access

# Vim/etc/squid. conf

Add the following content:

Acl httpd proto HTTP

Acl good_domain dstdomain .baidu.com .aminglinux.com .lishiming.net

Http_access allow good_domain

Http_access deny! Good_domain

Check the syntax of the configuration file:

# Squid-kcheck

No problem restarting squid

# Service squid restart

Or reload the configuration file.

# Squid-kre

Iv. Reverse Proxy

Http_port 80 accel vhost vport

Cache_peer 61.135.169.125 parent 80 0 originserver name =

Cache_peer_domain a www.baidu.com

Cache_peer 61.135.157.156 parent 80 0 originserver name = B

Cache_peer_domain B www.qq.com

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.