Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nginx: disable open_file_cache if media is on NFS #17251

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions docker/main/rootfs/etc/s6-overlay/s6-rc.d/nginx/run
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,15 @@ python3 /usr/local/nginx/get_tls_settings.py | \
tempio -template /usr/local/nginx/templates/listen.gotmpl \
-out /usr/local/nginx/conf/listen.conf

# disable open_file_cache on NFS filesystems
# https://trac.nginx.org/nginx/ticket/478
NFS_CLIPS_FS=`findmnt -n -o FSTYPE --target /media/frigate/clips`

shopt -s nocasematch; if [[ "$NFS_CLIPS_FS" =~ ^nfs* ]]; then
echo "[INFO] NFS mount detected for /media/frigate/clips, disabling NGINX open_file_cache"
echo "open_file_cache off;" > /usr/local/nginx/conf/open_file_cache.conf
fi

# Replace the bash process with the NGINX process, redirecting stderr to stdout
exec 2>&1
exec \
Expand Down
5 changes: 1 addition & 4 deletions docker/main/rootfs/usr/local/nginx/conf/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,7 @@ http {
vod_hls_mpegts_interleave_frames on;

# file handle caching / aio
open_file_cache max=1000 inactive=5m;
open_file_cache_valid 2m;
open_file_cache_min_uses 1;
open_file_cache_errors on;
include open_file_cache.conf;
aio on;

# file upload size
Expand Down
4 changes: 4 additions & 0 deletions docker/main/rootfs/usr/local/nginx/conf/open_file_cache.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
open_file_cache max=1000 inactive=5m;
open_file_cache_valid 2m;
open_file_cache_min_uses 1;
open_file_cache_errors on;