Nginx over NFS

Nginx over NFS

To keep Webroots in sync in clustered Webserver environments people often use Nginx over NFS as Storage Device. Because of the lack of speed, network overhead and response time of shared storage especially Nginx over NFS there could be a problem in serving dynamic content.

The solution to get rid of it I found a nice service called CacheFS which relies on fscache module and cachesfilesd daemon. With this solution it’s possible to buffer NFS mounts on your local disk.

So let’s do that!

First of all we need to install the package:

apt-get install cachefilesd

set RUN=yes in /etc/default/cachefilesd

after that you need to set the attributes: “fsc” and “user_xattr” in your /etc/fstab

UUID=123456789-xxxxxx      /     ext4    errors=remount-ro,user_xattr  0 1
192.168.1.X:/volumes/nfsdir /storage    nfs    fsc    0 0

After you rebooted your system, the service should be ready.

The Daemon will now locate the cache files to your local: /var/cache/fscache directory

nginxObservium
Comments ( 1 )
Add Comment
  • Grieb62567

    Thanks for the in-depth examples. Very useful.