Hi Guys,
Totally new to varnish but gotta start somewhere. As per http://ellislab.com/blog/entry/making_sites_fly_with_varnish I went thru all the steps I believe. I’m running Ubuntu 10.4 and installed Varnish 3.0 using https://www.varnish-cache.org/installation/ubuntu
I created a file main.vcl at /etc/varnish/main.vcl and put just
backend default {
.host = '127.0.0.1'; # IP address of your backend (Apache, nginx, etc.)
.port = '8080'; # Port your backend is listening on
}
sub vcl_recv {
# Set the URI of your system directory
if (req.url ~ '^/system/' ||
req.url ~ 'ACT=' ||
req.request == 'POST')
{
return (pass);
}
unset req.http.Cookie;
return(lookup);
}
sub vcl_fetch {
# Our cache TTL
set beresp.ttl = 1m;
return(deliver);
}
..into it and restarted apache. Do I change the 127.0.0.1 to my actual hostname IP of eg 150.151.152.153?
My system folder is the default “system”.
The full path to my system folder is /srv/www/mysite.com/public_html/system
Should I change /system/ in the vcl file to something else? Changing /system/ to /srv/www/mysite.com/public_html/system/ didnt work :(
/etc/varnish/main.vcl is correct and exists at that location on my server.
Using the recommended settings from Kevin I get the error:
root@li482-221:~# root@li482-221:~# varnishd -f /etc/varnish/main.vcl -s malloc,200M
-bash: root@li482-221:~#: command not found
root@li482-221:~# Message from VCC-compiler:
-bash: Message: command not found
root@li482-221:~# Syntax error at
-bash: Syntax: command not found
root@li482-221:~# ('input' Line 9 Pos 19)
-bash: input: command not found
root@li482-221:~# if (req.url ~ '^/system/' ||
>
> ------------------#--------------
>
> Running VCC-compiler failed, exit 1
>
> VCL compilation failed
Line 9 being
if (req.url ~ '^/system/' ||
..so could someone identify what I am doing wrong please. I also tried ” instead of ’ quotes which didnt throw an error in SSH but instead i get
root@li482-221:~# varnishd -f /etc/varnish/main.vcl -s malloc,200M
WARNING: Taking over SHMFILE marked as owned by running process (pid=20740)
root@li482-221:~# sudo service apache2 restart
* Restarting web server apache2 ... waiting [ OK ]
root@li482-221:~# sudo service varnish start
* Starting HTTP accelerator varnishd [fail]
I also changed the apache port to 8080 in ports.conf using http://www.umarani.com/varnish as a loose guide.
Using Putty for SSH.
Thanks!!!