Cannot get new Mercury installation to answer on port 80
hostname:
indiestudio-s2
hosts:
127.0.0.1 localhost
173.255.213.31 indiestudio-s2
173.255.213.31 indiewriterdirectory.com indiestudio-s2
173.255.213.31
ports:
NameVirtualHost 173.255.213.31:9880
Listen 9880
NameVirtualHost statement here
Listen 443
/etc/default/varnish
instance=pressflow
DAEMON_OPTS="-a :80 \
-T localhost:6082 \
-b localhost:9880 \
-f /etc/varnish/pressflow.vcl \
-S /etc/varnish/secret \
-u varnish -g varnish \
-s file,/var/lib/varnish/$INSTANCE/varnish_storage.bin,250MB"
/etc/varnish/pressflow.vcl
backend default {
.host = "127.0.0.1";
.port = "9880";
.connect_timeout = 600s;
.firstbytetimeout = 600s;
.betweenbytestimeout = 600s;
}
If anyone can give me a heads up as to what I'm not configuring correctly that would be AWESOME.
8 Replies
how do I know if varnish is even working? i know pressflow is working to some extent because when i go to my new site at
drupal seems to be acting completely normal except that i cannot access at port 80.
ServerAlias
ServerAdmin
DocumentRoot /srv/www/indie-studio
ErrorLog /srv/www/indie-studio/logs/error.log
CustomLog /srv/www/indie-studio/logs/access.log combined
I had the exact IP named in this and the ports.conf files, but just changed to an asterisk trying to troubleshoot. The site answers to the above DNS names IF the port 9880 is appended.
Current ports.conf…
NameVirtualHost *:9880
Listen 9880
NameVirtualHost statement here
Listen 443
When i try and restart varnish with /etc/init.d/varnish restart i get:
Starting HTTP accelerator: varnishd failed! /usr/sbin/varnishd: invalid option -- S usage: varnishd [options]
And in my Drupal it is saying:
Warning: socket_connect() [function.socket-connect]: unable to connect [111]: Connection refused in _varnishterminalrun() (line 197 of /srv/www/indie-studio/sites/all/modules/varnish/varnish.module).
Have moved ahead a little bit - Linode pointed out that there needed to be a folder created per the error message above. I created the folder and then Varnish didn't like the DAEMON OPTS switches. Removed the -b switch. Now restarting varnish produces:
Stopping HTTP accelerator: varnishd failed!
Starting HTTP accelerator: varnishd failed!
Expected ID got '.'
(program line 92), at
(/etc/varnish/pressflow.vcl Line 8 Pos 1)
.host = "127.0.0.1";
Line eight is the host line from below:
backend default {
.host = "127.0.0.1";
.port = "9880";
.connect_timeout = 600s;
.firstbytetimeout = 600s;
.betweenbytestimeout = 600s;
.max_connections = 800;
}
But everywhere online I check this is right. Very puzzled.
1) I had to create the /usr/bin/varnishd folder. It didn't exist.
2) I think the sample /etc/default/varnish file in the doc is off. It shows the below configuration:
DAEMON_OPTS="-a :80 \
-T localhost:6082 \
-b localhost:9880 \
-f /etc/varnish/pressflow.vcl \
-S /etc/varnish/secret \
-s file,/var/lib/varnish/$INSTANCE/varnish_storage.bin,135MB"
However varnish griped at me and said only -b or -f could be used. Not both. So I used -f.
3) Then varnish didn't like the sample pressflow.vcl. Had to strip it down to this for varnish to even load:
If you're running a single site on a server, or else want all sites
on a server to go through Varnish you'd only need one of the following backends.
Showing different possibilities for those who have sites that they
don't want to run Varnish on. In this example file, Varnish is assumed to
be running on port 80, and Apache (or whatever) on port 8080.
backend default {
set backend.host = "127.0.0.1";
set backend.port = "9880";
}
sub vcl_hash {
if (req.http.Cookie) {
set req.hash += req.http.Cookie;
}
}
*Note that this uses "set backend.host" as opposed to just ".host". Varnish didn't like .host amongst other things. So I'll have to research ideal vcl settings for pressflow sites. If anyone has any post them!
All the linode doc steps were good, but the missing folder and configuration files were getting me. Not sure if varnish versions changed or what as I'm new to this.