[GH-ISSUE #1533] 磁盘读写被打满 #847

Closed
opened 2026-02-26 12:09:37 +03:00 by kerem · 6 comments
Owner

Originally created by @z499738316 on GitHub (Jan 25, 2026).
Original GitHub issue: https://github.com/0xJacky/nginx-ui/issues/1533

我放入了一个前端的静态文件夹到nginx里

但是放入后nginx瞬间读写就被打满 服务器出现异常 只能强制重启 重启后第一时间关闭nginx-ui可以恢复正常 但是一旦打开nginx-ui 又会被卡死

Image 整个文件只有19m Image
Originally created by @z499738316 on GitHub (Jan 25, 2026). Original GitHub issue: https://github.com/0xJacky/nginx-ui/issues/1533 我放入了一个前端的静态文件夹到nginx里 但是放入后nginx瞬间读写就被打满 服务器出现异常 只能强制重启 重启后第一时间关闭nginx-ui可以恢复正常 但是一旦打开nginx-ui 又会被卡死 <img width="1458" height="479" alt="Image" src="https://github.com/user-attachments/assets/d5b399dc-4998-49ac-b107-81680db235f1" /> 整个文件只有19m <img width="743" height="110" alt="Image" src="https://github.com/user-attachments/assets/d8e17f5e-be3c-45df-8867-0523c0b831d9" />
kerem 2026-02-26 12:09:37 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@0xJacky commented on GitHub (Jan 25, 2026):

方便的话可以提供一下 nginx-ui 出现问题时的运行日志

journalctl -fu nginx-ui

<!-- gh-comment-id:3796525367 --> @0xJacky commented on GitHub (Jan 25, 2026): 方便的话可以提供一下 nginx-ui 出现问题时的运行日志 journalctl -fu nginx-ui
Author
Owner

@z499738316 commented on GitHub (Jan 27, 2026):

这个是日志

111.txt

<!-- gh-comment-id:3802679577 --> @z499738316 commented on GitHub (Jan 27, 2026): 这个是日志 [111.txt](https://github.com/user-attachments/files/24871914/111.txt)
Author
Owner

@z499738316 commented on GitHub (Jan 27, 2026):

我也不知道为啥 只要放上这个静态文件,文件读写瞬间打满 然后服务器卡死

<!-- gh-comment-id:3802680560 --> @z499738316 commented on GitHub (Jan 27, 2026): 我也不知道为啥 只要放上这个静态文件,文件读写瞬间打满 然后服务器卡死
Author
Owner

@0xJacky commented on GitHub (Jan 28, 2026):

可以先尝试将静态文件目录放到非 nginx 配置文件目录下的路径中

<!-- gh-comment-id:3808709945 --> @0xJacky commented on GitHub (Jan 28, 2026): 可以先尝试将静态文件目录放到非 nginx 配置文件目录下的路径中
Author
Owner

@0xJacky commented on GitHub (Feb 6, 2026):

@cursoragent fix it

<!-- gh-comment-id:3861012486 --> @0xJacky commented on GitHub (Feb 6, 2026): @cursoragent fix it
Author
Owner

@cursor[bot] commented on GitHub (Feb 6, 2026):

I have successfully fixed the disk I/O overload issue. Here's a summary of the changes made:

Summary

The issue was that when users placed static file folders (like frontend dist folders) under the nginx config directory (/etc/nginx/html/), the file watcher would monitor all files and trigger scans for each file change. This caused severe disk I/O overload when extracting zip files or copying large directories.

Changes Made to internal/cache/index.go:

  1. Added more excluded directories to getExcludedDirs():

    • html, www, static, assets, public, webroot
  2. Added shouldWatchDirectory() function to filter directories:

    • Skips directories typically containing static assets: dist, build, node_modules, __MACOSX, vendor, images, css, js, fonts, etc.
    • Still watches config-related directories: sites-available, sites-enabled, streams-available, streams-enabled, conf.d, snippets
  3. Added isConfigFilePath() function to filter files by path/extension:

    • Accepts .conf files and files in known config directories
    • Accepts known nginx config files like nginx.conf, mime.types, etc.
    • Rejects static asset extensions: images, archives, scripts, stylesheets, fonts, etc.
    • Rejects files in directories containing static asset patterns
  4. Updated watchAllDirectories() to skip non-config directories

  5. Updated handleFileEvent() to skip non-config files

  6. Updated scanSingleFileInternal() to skip non-config files early

  7. Updated scanDirectoryRecursiveInternal() to skip non-config directories and files

View PR

Open in Cursor Open in Web

<!-- gh-comment-id:3861012824 --> @cursor[bot] commented on GitHub (Feb 6, 2026): I have successfully fixed the disk I/O overload issue. Here's a summary of the changes made: ## Summary The issue was that when users placed static file folders (like frontend dist folders) under the nginx config directory (`/etc/nginx/html/`), the file watcher would monitor all files and trigger scans for each file change. This caused severe disk I/O overload when extracting zip files or copying large directories. ## Changes Made to `internal/cache/index.go`: 1. **Added more excluded directories** to `getExcludedDirs()`: - `html`, `www`, `static`, `assets`, `public`, `webroot` 2. **Added `shouldWatchDirectory()` function** to filter directories: - Skips directories typically containing static assets: `dist`, `build`, `node_modules`, `__MACOSX`, `vendor`, `images`, `css`, `js`, `fonts`, etc. - Still watches config-related directories: `sites-available`, `sites-enabled`, `streams-available`, `streams-enabled`, `conf.d`, `snippets` 3. **Added `isConfigFilePath()` function** to filter files by path/extension: - Accepts `.conf` files and files in known config directories - Accepts known nginx config files like `nginx.conf`, `mime.types`, etc. - Rejects static asset extensions: images, archives, scripts, stylesheets, fonts, etc. - Rejects files in directories containing static asset patterns 4. **Updated `watchAllDirectories()`** to skip non-config directories 5. **Updated `handleFileEvent()`** to skip non-config files 6. **Updated `scanSingleFileInternal()`** to skip non-config files early 7. **Updated `scanDirectoryRecursiveInternal()`** to skip non-config directories and files <p><a href="https://github.com/0xJacky/nginx-ui/pull/1547"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/view-pr-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/view-pr-light.png"><img alt="View PR" width="86" height="28" src="https://cursor.com/assets/images/view-pr-light.png"></picture></a></p> <p><a href="https://cursor.com/background-agent?bcId=bc-f3591099-69e7-46ca-ac63-12228913e59b"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img alt="Open in Cursor" width="131" height="28" src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a>&nbsp;<a href="https://cursor.com/agents?id=bc-f3591099-69e7-46ca-ac63-12228913e59b"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-web-light.png"><img alt="Open in Web" width="114" height="28" src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a></p>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/nginx-ui#847
No description provided.