Categories: How-ToNginx

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

Jules

Jules is the owner and author of ISPIRE.ME. He's a Linux System Engineer, Tech fanatic and an Open Source fan.

View Comments

Recent Posts

HTTP/2 SSL Offloading with Hitch and Varnish

HTTP/2 SSL Offloading with Hitch and Varnish Since Chrome browsers showing you insecure warning on…

7 years ago

File changed as we read it GlusterFS issue

File changed as we read it GlusterFS issue Recently i had trouble running Backups of…

8 years ago

Running multiple instances of varnish using systemd

Running multiple instances of varnish using systemd If you have not yet found a complete…

8 years ago

HTTP/2 SSL Offloading with Haproxy and Nginx

HTTP/2 SSL Offloading with Haproxy and Nginx After HTTP/2 becoming more an more prominent regarding SSL…

8 years ago

Get Real IP with Haproxy Tomcat Jira Confluence using x-forwarded-for

Get Real IP with Haproxy Tomcat Jira Confluence using x-forwarded-for Everyone knows the Problem. Get…

8 years ago

Review TDS2 How to backtest using tick data with Metatrader 4

Review TDS2 How to backtest using tick data with Metatrader 4 in this Review TDS2…

8 years ago

This website uses cookies.