• Categories
    Category
  • Categories
    Category
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial Comments FAQ Related Articles

How to Configure Reverse Proxy with Squid in CentOS

959

To Configure Reverse Proxy with Squid in CentOS

Squid is a proxy servers that acts as a reverse proxy to increase the performance for web services. The proxy server will stand behind the firewall of local network and redirects the every request from clients to backend webservers. This article shows how to configure reverse proxy with squid in CentOS.

Testing Environment

IP Address Hostname
Squid Proxy Server 192.168.5.237 node1.example.com
Web Server 192.168.5.238 node2.example.com


Pre-requisites

Basic webserver like Apache is required.
Fully qualified domain name is required for both machines including squid proxy server and web server.
Hostname resolution between two servers, either configure DNS or create entry as follows on /etc/hosts file,


192.168.5.237 node1.example.com node1
192.168.5.238 node2.example.com node2

Installation of Squid package

Run the following command to install Squid package.

[root@node1 ~]# yum install squid -y 
Loaded plugins: fastestmirror, langpacks
base | 3.6 kB 00:00:01
extras | 3.4 kB 00:00:00
updates | 3.4 kB 00:00:00
Loading mirror speeds from cached hostfile
* base: mirror.fibergrid.in
* extras: mirror.fibergrid.in
* updates: mirror.fibergrid.in
Resolving Dependencies
-->  Running transaction check
--->  Package squid.x86_64 7:3.3.8-26.el7_2.4 will be installed
.
.
.
Installed:
squid.x86_64 7:3.3.8-26.el7_2.4

Dependency Installed:
libecap.x86_64 0:0.2.0-9.el7 perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7 perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7 perl-DBI.x86_64 0:1.627-4.el7
perl-Data-Dumper.x86_64 0:2.145-3.el7 perl-Digest.noarch 0:1.17-245.el7 perl-Digest-MD5.x86_64 0:2.52-3.el7 perl-IO-Compress.noarch 0:2.061-2.el7
perl-Net-Daemon.noarch 0:0.48-5.el7 perl-PlRPC.noarch 0:0.2020-14.el7

Complete!


To Configure Squid as Reverse Proxy

Utilize the following command to configure Squid as reverse proxy. Edit the squid’ s default configuration file as follows,

[root@node1 ~]# vim /etc/squid/squid.conf

Add the below lines under line number 53 and specify the FQDN of backend webserver http_port 80 accel defaultsite=node2.example.com in the 59th line. Finally, uncomment the 62nd line (remove “ #” symbol before the line).

#cache_dir ufs /var/spool/squid 100 16 256
cache_peer node2.example.com parent 80 0 no-query originserver
cache_mem 256 MB
visible_hostname node1.example.com

Once the squid is configured, start and enable the service to take effect.

[root@node1 ~]# systemctl restart squid
[root@node1 ~]# systemctl enable squid
ln -s ' /usr/lib/systemd/system/squid.service'  ' /etc/systemd/system/multi-user.target.wants/squid.service' 


Open the web browser with the hostname of squid proxy machine to check the output. It will display the content from the web server that acts in the back-end of reverse proxy settings.

squid proxy machine

Tags:
nathan
Author: 

Comments ( 0 )

No comments available

Add a comment

Frequently asked questions ( 5 )

Q

How to set up squid to forward the right request to the right web server?

A

you can setup port 80 or 443 to forward to your exchange server/OWA and then some random port to forward to your VM server.

Q

How does a proxy server improve security?

A

A proxy server reduces the chance of a breach. Proxy servers add an additional layer of security between your servers and outside traffic. Because proxy servers can face the internet and relay requests from computers outside the network, they act as a buffer.

# Squid normally listens to port 3128
http_port 3128 accel defaultsi

Q

Is a reverse proxy secure?

A

In the case of secure websites, a web server may not perform SSL encryption itself, but instead offloads the task to a reverse proxy that may be equipped with SSL acceleration hardware. A reverse proxy can distribute the load from incoming requests to several servers, with each server serving its own application area.

Q

What is proxy server Linux?

A

A proxy server is a computer that acts as an intermediary between a desktop computer and the internet and allows a client machine to make an indirect connection to network servers and services.

Q

What is squid reverse proxy?

A

Squid is a caching and forwarding HTTP web proxy. It has a wide variety of uses, including speeding up a web server by caching repeated requests, caching web, DNS and other computer network lookups for a group of people sharing network resources, and aiding security by filtering traffic.

Related Tutorials in How to Configure Reverse Proxy with Squid in CentOS

Related Tutorials in How to Configure Reverse Proxy with Squid in CentOS

How to limit bandwidth in Squid - Part 4
How to limit bandwidth in Squid - Part 4
Jun 28, 2016
How to install squid proxy server on freeBSD
How to install squid proxy server on freeBSD
Feb 10, 2017
How to block with keywords and extensions in SQUID - Part 2
How to block with keywords and extensions in SQUID - Part 2
Jun 22, 2016
How to Configure Reverse Proxy with Squid in CentOS
How to Configure Reverse Proxy with Squid in CentOS
Dec 9, 2016
How to install Squid in Webmin
How to install Squid in Webmin
Aug 26, 2017
How to Compile Squid Proxy Server 4.7v on CentOS 7.6
How to Compile Squid Proxy Server 4.7v on CentOS 7.6
Jun 14, 2019
How to use Ntopng using Squid proxy server
How to use Ntopng using Squid proxy server
Sep 2, 2017
How to Install and Configure Squid Proxy in Ubuntu 20.4.1
How to Install and Configure Squid Proxy in Ubuntu 20.4.1
Nov 28, 2020

Related Forums in How to Configure Reverse Proxy with Squid in CentOS

Related Forums in How to Configure Reverse Proxy with Squid in CentOS

Squid
oliver class=
how to clear squid cache
Feb 7, 2017
Squid
owen class=
How to change default logformat in squid access log
Sep 1, 2017
Squid
hobbs class=
WARNING: Could not determine this machines public hostname. Please configure one or set visible_hostname.
Sep 21, 2017
Squid
oliver class=
How to allow only one site in SQUID
Feb 11, 2017
Squid
nathan class=
SARG : make[1]: *** [check-macro-version] Error 1
Sep 27, 2017
Squid
owen class=
How to view squid logs in human readable format
Sep 21, 2017
Squid
nicholas class=
How to limit download speed in SQUID
Feb 20, 2017
CentOS
jayce class=
WARNING: Cannot write log file: /var/logs/cache.log /var/logs/cache.log: Permission denied messages will be sent to 'stderr'.
Jun 1, 2019
Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Ganesh Konka ?
Zentya 6.1 http proxy configuration

please send link for creating zentyal 6.1 for http proxy and firewall as gateway.

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.