Control Web Panel

WebPanel => Apache => Varnish => Topic started by: Administrator on May 18, 2014, 11:30:07 PM

Title: How to install varnish cache on centos [CWP]
Post by: Administrator on May 18, 2014, 11:30:07 PM
This is very simple tutorial how to use and install Varnish Cache Server on CentOS using CWP panel.

1. In your CWP menu find Varnish
2. Click on install
3. Setup Config

Default config to use/enable Varnish Cache Server is:
Code: [Select]
Apache IP: (Your Shared IP, or 127.0.0.1)
Apache port: 82
Varnish IP: (default all, if you need to change than edit config files  manually)
Varnish Port: 80
If you are getting default CWP page on your domain index then you can try setting your shared ip to 127.0.0.1


How to check if Varnish Cache Server Works?
- Using CURL command  "curl -i SERVER-IP" you will get headers and on beginning of the output try finding "X-Varnish"
- Using this website "http://www.whatismyip.com/server-headers-check/ (http://www.whatismyip.com/server-headers-check/)" in Response find "X-Varnish"




Default config to disable Varnish Cache and use Apache only is:
Code: [Select]
Apache IP: (Your Shared IP)
Apache port: 80
Varnish IP: (default all, if you need to change than edit config files  manually)
Varnish Port: 6081
Title: Re: How to install varnish cache on centos [CWP]
Post by: carmageddon63 on July 26, 2014, 11:43:42 PM
thanks.

but varnish is not start next restart.

don't forgat add to varnish on startup.

chkconfig --levels 235 varnish on
Title: Re: How to install varnish cache on centos [CWP]
Post by: nyol on July 31, 2014, 03:39:24 PM
Thanks for your tip carmageddon63
Title: Re: How to install varnish cache on centos [CWP]
Post by: zietbukuel on September 12, 2014, 02:14:59 AM
thanks.

but varnish is not start next restart.

don't forgat add to varnish on startup.

chkconfig --levels 235 varnish on
Thanks!
Title: Re: How to install varnish cache on centos [CWP]
Post by: Glenn on December 09, 2014, 10:02:34 AM
Hi there

I currently have my shared ip setup to 127.0.0.1 as per a post i found on the forum in order to resolve an issue whereby all my sites would go to the default index page , however with the new functionality in CWP if i suspend a site it redirects me to 127.0.0.1 does anyone know a work around or better yet how to use my live ip address ?
Title: Re: How to install varnish cache on centos [CWP]
Post by: Administrator on December 10, 2014, 03:36:31 AM
suspend account redirect is set on the shared server ip address.
Title: Re: How to install varnish cache on centos [CWP]
Post by: sergejdds on January 21, 2015, 01:03:54 PM
I am getting a 503 error after installing varnish :( anybody with the same problem?
Title: Re: How to install varnish cache on centos [CWP]
Post by: sogellizer on January 21, 2015, 07:26:04 PM
How to disable or remove varnish? I using CWM in my VPS host.

when i want to delete the yum yum remove varnish not work.

(http://s17.postimg.org/lir08tkpr/Remove_Vanish.png)

why I want to delete? because it does not work on my VPS  :-[

please help me...
Title: Re: How to install varnish cache on centos [CWP]
Post by: alexchar on January 23, 2015, 07:14:07 PM
You can disable it. See the instructions in the first post.
Title: Re: How to install varnish cache on centos [CWP]
Post by: Farukh Khan on February 12, 2015, 07:42:13 PM
Isn't there any way in which we can set the Apache IP address to my server's public IP and all the websites hosted in my server works? Setting the Apache IP to 127.0.0.1 is making my mailing function not working and also all the visitors of my website are known as visited from 127.0.0.1  Varnish should work correctly with my server's public IP set in the Apache's IP...
Title: Re: How to install varnish cache on centos [CWP]
Post by: Administrator on March 10, 2015, 12:56:02 PM
you have in the first post that you can use the shared server IP.
Title: Re: How to install varnish cache on centos [CWP]
Post by: tomidjx on March 23, 2015, 06:19:24 PM
you have in the first post that you can use the shared server IP.

Hello sir, I'm facing the same problem

When running Varnish (port 80, with apache set at at port 82) with 127.0.0.1 as shared ip, it works.

however, when i set my default shared ip (the server public ip) any domain will show the server default page.

For a number of reasons I need my server ip as the default shared ip.

how can this be solved?

thank you.
Title: Re: How to install varnish cache on centos [CWP]
Post by: Administrator on March 24, 2015, 04:33:12 PM
new version has multi ip varnish configuration with virtual hosts so you can try it.
Title: Re: How to install varnish cache on centos [CWP]
Post by: tomidjx on March 27, 2015, 09:19:42 PM
ok, varnish is running properly now (at least so it seems..)

what i did is:
in CentOS Web Panel Settings --> Edit setting, I did set my IP
in Varnish Settings i did set port 82 for Apache, My server IP for Apache IP, and port 80 for Varnish, leaving the rest as default.
That way it worked with Varnish and my IP (not 127.0.0.1)

I don't know if this configuration will, creating other problems along, but for the moment Varnish is working, with my server IP.

Hope it can help someone.
Title: Re: How to install varnish cache on centos [CWP]
Post by: Administrator on March 30, 2015, 02:46:40 PM
info is added on the wiki
http://wiki.centos-webpanel.com/how-to-install-varnish
Title: Re: How to install varnish cache on centos [CWP]
Post by: Giannis on July 22, 2015, 01:57:27 PM
Nice i will try it.
Title: Re: How to install varnish cache on centos [CWP]
Post by: billyf on May 18, 2017, 01:37:03 PM
I do not see Varnish anyplace on CWP.  I am running CWPpro version: 0.9.8.238
Why dont I have it ?
Title: Re: How to install varnish cache on centos [CWP]
Post by: Administrator on May 18, 2017, 09:42:48 PM
its under WebServers in left menu
Title: Re: How to install varnish cache on centos [CWP]
Post by: freeeze on May 17, 2018, 12:50:52 PM
Doing that way Admin, it doesn't work, when I click after on Varnish Conf (under apache>webservers tab), it is said that it is not installed :/
Title: Re: How to install varnish cache on centos [CWP]
Post by: freeeze on May 17, 2018, 12:53:15 PM
More generally, there's such bugs if I want to activate Apache+Nginx+Varnish...same issue with Apache+Nginx...I think I will remove that CWP and try Webmin instead, I lose time with this CWP :/
Title: Re: How to install varnish cache on centos [CWP]
Post by: tiagondelgado on July 16, 2018, 09:52:48 AM
hello, my server only have port 80 and 443 opend. All the rest are close, my server is Apache & Varnish Cache & Nginx Reverse Proxy.

So i need open port 82 and 8181?

Result https://www.whatismyip.com/server-headers-check

HTTP/1.1 200 OK
nginx/1.14.0
Mon, 16 Jul 2018 09:50:20 GMT
text/html; charset=utf-8
chunked
keep-alive
Accept-Encoding
200182
0
1.1 varnish (Varnish/5.2)
bytes
HIT from Backend
Title: Re: How to install varnish cache on centos [CWP]
Post by: studio4host on July 17, 2018, 01:51:13 PM
only ports 80 and 443 are needed others not for clients as they will only use those for http and https
Title: Re: How to install varnish cache on centos [CWP]
Post by: tiagondelgado on July 30, 2018, 02:46:58 PM
Good thanks  8)
Title: Re: How to install varnish cache on centos [CWP]
Post by: devstar on June 28, 2019, 12:17:34 PM
Can I use Varnish and Nginx both on CWP? I have a website on local that i want to move here but it is using both varnish cache (https://www.cloudways.com/blog/configure-varnish-cache/) and nginx. Both requires root access to install and configure.