Install Varnish on cpanel server Print

  • 114

Since i am trying to install on my server boxes Varnish from resource i am going to present you a complete guide how to perform this.

Since Varnish is a reverse proxy to Apache  we don’t want our log file to record the proxy IP. We want the real IP as usual. This will make sure our stats page like Webalizer and AWstats will record the correct information. So we need to install mod_rpaf which is “Reverse Proxy Add Forward” module for Apache. You can download that at http://stderr.net/apache/rpaf/download:

cd /usr/local/src
wget http://stderr.net/apache/rpaf/download/mod_rpaf-0.6.tar.gz
tar -xzf mod_rpaf-0.6.tar.gz
cd mod_rpaf-*
apxs -i -c -n mod_rpaf-2.0.so mod_rpaf-2.0.c

2. Once installed, we need to load the module into Apache configuration. Since cPanel already has Include Editor for Apache, we will use that functions. Login to WHM > Service Configuration > Apache Configuration > Include Editor > Pre Main Include > All Versions and paste following text:

LoadModule rpaf_module modules/mod_rpaf-2.0.so
RPAFenable On
RPAFproxy_ips 127.0.0.1  123.124.125.88 # replace the value with your server IP
RPAFsethostname On
RPAFheader X-Real-IP

3. Click Update > Restart Apache. The module should be loaded after restart.

And now lets the journey begins

To use the varnish-cache.org repository, run

rpm --nosignature -i http://repo.varnish-cache.org/redhat/varnish-3.0/el5/noarch/varnish-release-3.0-1.noarch.rpm

and then run

yum install varnish

The --no-signature is only needed on initial installation, since the Varnish GPG key is not yet in the yum keyring.

If you get the following error

Resolving Dependencies
--> Running transaction check
---> Package varnish.x86_64 0:3.0.1-1.el5 set to be updated
--> Processing Dependency: varnish-libs = 3.0.1-1.el5 for package: varnish
--> Processing Dependency: libedit.so.0()(64bit) for package: varnish
--> Running transaction check
---> Package varnish.x86_64 0:3.0.1-1.el5 set to be updated
--> Processing Dependency: libedit.so.0()(64bit) for package: varnish
---> Package varnish-libs.x86_64 0:3.0.1-1.el5 set to be updated
--> Finished Dependency Resolution
varnish-3.0.1-1.el5.x86_64 from varnish-3.0 has depsolving problems
  --> Missing Dependency: libedit.so.0()(64bit) is needed by package varnish-3.0.1-1.el5.x86_64 (varnish-3.0)
Error: Missing Dependency: libedit.so.0()(64bit) is needed by package varnish-3.0.1-1.el5.x86_64 (varnish-3.0)
 You could try using --skip-broken to work around the problem
 You could try running: package-cleanup --problems
                        package-cleanup --dupes
                        rpm -Va --nofiles --nodigest


Type the following command to fix it
# rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm

yum install varnish
in order to start varnish for first time

service varnish start
service varnish restart

 

 


هل كانت المقالة مفيدة ؟
Back