RHEL6.4 build Squid Reverse Proxy Server

Source: Internet
Author: User
Tags website server squid proxy
Lab requirement: Use squid to build a reverse proxy server and enable domain name-based virtual hosts on the Intranet server 192.168.100.1, so that the client can access www.linuxidc.com and bbs.linuxidc.com & nb through the Domain Name

Lab requirement: Use squid to build a reverse proxy server and enable domain name-based virtual hosts on the Intranet server 192.168.100.1, so that the client can access www.linuxidc.com and bbs.linuxidc.com through the domain name.

Intranet interface eth0 (192.168.1.254)

Intranet web server 192.168.100.1 ---------- squid reverse proxy server ------------- Internet client 1.1.1.1

Public Network Interface eth1 (1.1.1.254)


1. Configure the Intranet website server 192.168.100.1

You can use apache, nginx, and other software to build the project. In this experiment, nginx is used to build the project.

1. Install nginx and edit the configuration file

# Vim/usr/local/nginx/conf/nginx. conf

Http {

......

Server {

Listen 80;

Server_name www.linuxidc.com;

Location /{

Root/www;

Index index.html;

}

}

Server {

Listen 80;

Server_name bbs.linuxidc.com;

Location /{

Root/bbs;

Index index.html;

 


}

}

......

2. Create a test webpage File

# Mkdir/www

# Mkdir/bbs

# Echo www.linuxidc.com>/www/index.html

# Echo bbs.linuxidc.com>/bbs/index.html

3. Start the service

# Cd/usr/local/nginx/sbin

#./Nginx

2. Configure the squid Reverse Proxy Server

1. Install software

# Yum-y install squid

2. Edit the configuration file

# Vim/etc/squid. conf

......

# And finally deny all other access to this proxy

# Http_access deny all

Http_access allow all


# Squid normally listens to port 3128

Http_port 80 vhost // listen to port 80 for client access

Cache_peer 192.168.100.1 parent 80 0 originserver name = www

Cache_peer 192.168.100.1 parent 80 0 originserver name = bbs

Cache_peer_domain www www.linuxidc.com

Cache_peer_domain bbs bbs.linuxidc.com

 


# We recommend you to use at least the following line.

Hierarchy_stoplist cgi-bin?

Cache_mem 8 MB

Minimum_object_size 0 KB

Maximum_object_size 4096 KB

Cache_swap_low 90

Cache_swap_high 95

# Uncomment and adjust the following to add a disk cache directory.

Cache_dir ufs/var/spool/squid 100 16 256

......


3. Release port 80 and start the service

# Service httpd stop // If the website service is enabled on this server, it is disabled or enabled on another port

# Chkconfig httpd off

# Service iptables stop

# Chkconfig iptables off

# Service squid start

# Chkconfig squid on

# Netstat-tulnp | grep: 80

Tcp 0 0: 80: * LISTEN 3007/(squid)

Iii. Client 1.1.1.1 Test

In the production environment, direct www.linuxidc.com and bbs.linuxidc.com to the reverse proxy server 1.1.1.254 on the DNS server.

In the test environment, edit the IP address corresponding to the hosts file resolution domain name on the local machine

# Vim/etc/hosts

1.1.1.254 www.linuxidc.com

1.1.1.254 bbs.linuxidc.com


# Elinks-dump http://www.linuxidc.com

Www.linuxidc.com

# Elinks-dump http://bbs.linuxidc.com

Bbs.linuxidc.com

Squid: Click here
Squid: Click here

Configure Squid proxy http and rsync http://www.linuxidc.com/Linux/2013-05/84642.htm

Squid: high-speed Web Access http://www.linuxidc.com/Linux/2013-04/83512.htm

CentOS 6.2 compilation and installation Squid configuration reverse proxy server http://www.linuxidc.com/Linux/2012-11/74529.htm

Simple configuration of Squid proxy and reverse proxy http://www.linuxidc.com/Linux/2014-04/99465.htm

CentOS 6.4 DNS + Squid + Nginx + MySQL to build a high availability Web Server http://www.linuxidc.com/Linux/2014-04/99984.htm

This article permanently updates the link address: Http://www.linuxidc.com/Linux/2014-05/102220.htm

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.