Varnish 3 – Block ip addresses


To block ip addresses with Varnish edit the following file:

sudo nano /etc/varnish/default.vcl

And add the following. Of course replace the example ip addresses with the real ips you want to block.

acl forbidden {     "";     "";     "456.123.12.72"; } sub vcl_recv {     # Block access from these ips     if (client.ip ~ forbidden) {         error 403 "Forbidden";     } }

After editing, execute:

sudo service varnish restart

Varnish 3 – Exclude a virtual host


If you have multiple virtual hosts on your webserver, installing Varnish will cause all virtual hosts to be cached. With VCL it’s possible to exclude some virtual hosts.

sudo nano /etc/varnish/default.vcl
sub vcl_recv {     # Don't cache or - optional www     if ( ~ "(www\.)?(|\.(com|nl|org|dev|local)") {         return (pass);     } } sub vcl_deliver {     # You can optionally set a reponse header so it's easier for you to debug

More >

Ubuntu 12.04 – Install Varnish 3 in front of Apache 2


Step 1: Install latest version of Varnish (3.0)

These first three lines are probably not required on Ubuntu 12.04 because the main repository already contains version 3, but you can use it anyhow. Older version of Ubuntu do need it though!

curl | sudo apt-key add -
echo "deb lucid varnish-3.0" | sudo tee -a /etc/apt/sources.list
sudo apt-get update
sudo apt-get install varnish

Step 2: Set backend server (Apache)

Edit the varnish configuration file.

sudo nano /etc/varnish/default.vcl

Set the backend server. The lines below say that the backend server (Apache) is available More >

Test in IE6/7/8/9 on Ubuntu 12.04 with VirtualBox image


It’s always a bit difficult to test your webapplications in Internet Explorer if you are developing on Ubuntu. Your default test browser there will most likely be firefox. But with with VirtualBox and Microsoft’s “Internet Explorer Application Compatibility VPC Image” it’s possible to test your website in a native IE6, IE7, IE8, IE9 and so on. Even on different platforms like Windows XP, Windows Vista or Windows 7!

It’s a bit hard to set it up, but let me show you how!

UPDATE: Testing IE with VirtualBox on linux has become easier with the xdissent ievms project! More >

Command “df” in linux shows incorrect free space after file removal


Today the “/tmp” directory was full on a server because of a huge log file. When I checked it with the command “df -h” is saw that the directory used 100% of disk space. After I removed the log file, “df -h” still displayed the same value. I thought that it might be a caching problem, but the fact is that deleting a file name doesn’t actually delete the file. It is not visible anymore if you execute the command “ls -sal”, but if some other process is holding the file open, it is not really deleted.

To see which More >

Solr 3.5 – Search case insensitive on a string field for exact match


Solr has by default in the schema.xml the field type “string” available.

<!-- The StrField type is not analyzed, but indexed/stored verbatim. --> <fieldType name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true"/>

With this field type you can search with a string to get an exact match, instead of a contains match that the “text_general” field type will give you. However another difference is that the “text_general” field type is case insensitive by default and “string” is case sensitive.

To perform an case insensitive exact match search, you’ll have to add a custom field type More >

Solr 3.5 – Stop words are not removed


At stop word files can be downloaded for several languages. Also the one for the English language is more extended than the default one shipped with Solr.

However if you enable them with the solr.StopFilterFactory the stop words still are not removed. This is caused by the “|” pipe characters after each word. Solr wants every word on a new line without anything else. Also replacement of | to # doesn’t work. This problem can be hard to discover if you expect that information provided by the Solr website should just work.

So to still contain the More >

Go to Top