[GH-ISSUE #236] Support for cache configuration #1469

Closed
opened 2026-02-27 12:10:56 +03:00 by kerem · 3 comments
Owner

Originally created by @sanvu88 on GitHub (Dec 13, 2023).
Original GitHub issue: https://github.com/0xJacky/nginx-ui/issues/236

Caching both static and dynamic content of Nginx helps improve distribution speed for clients and reduces the load on the server.

To configure Nginx cache, I can provide a config template. However, I am encountering a small issue with configuring the cache storage directory.

proxy_cache_path /home/nginx/cache levels=1:2 keys_zone=my_cache:10m max_size=10g inactive=7d use_temp_path=off;

Currently, I have to manually create the directory /home/nginx/cache. However, it would be wonderful if the Nginx UI had a section for cache configuration and would automatically create the cache directory as entered.

Originally created by @sanvu88 on GitHub (Dec 13, 2023). Original GitHub issue: https://github.com/0xJacky/nginx-ui/issues/236 Caching both static and dynamic content of Nginx helps improve distribution speed for clients and reduces the load on the server. To configure Nginx cache, I can provide a config template. However, I am encountering a small issue with configuring the cache storage directory. ``` proxy_cache_path /home/nginx/cache levels=1:2 keys_zone=my_cache:10m max_size=10g inactive=7d use_temp_path=off; ``` Currently, I have to manually create the directory `/home/nginx/cache`. However, it would be wonderful if the Nginx UI had a section for cache configuration and would automatically create the cache directory as entered.
kerem 2026-02-27 12:10:56 +03:00
Author
Owner

@0xJacky commented on GitHub (Dec 14, 2023):

What about adding a volume section in config template? Then you can define a volume in the template, and user can set the path in the UI and it will be created if the directory is not exist.

<!-- gh-comment-id:1855722935 --> @0xJacky commented on GitHub (Dec 14, 2023): What about adding a volume section in config template? Then you can define a volume in the template, and user can set the path in the UI and it will be created if the directory is not exist.
Author
Owner

@sanvu88 commented on GitHub (Dec 15, 2023):

In my understanding, by default, Nginx will create a directory if it doesn't exist. However, it will only create the last directory in the path. For example, if my cache path is

/home/nginx/cache

and the cache directory does not exist, Nginx will create it. However, if both the nginx and cache directories do not exist, Nginx will return an error:

[emerg] mkdir() No such file or directory) nginx

<!-- gh-comment-id:1857244400 --> @sanvu88 commented on GitHub (Dec 15, 2023): In my understanding, by default, Nginx will create a directory if it doesn't exist. However, it will only create the last directory in the path. For example, if my cache path is ```/home/nginx/cache``` and the cache directory does not exist, Nginx will create it. However, if both the nginx and cache directories do not exist, Nginx will return an error: ```[emerg] mkdir() No such file or directory) nginx```
Author
Owner

@0xJacky commented on GitHub (Dec 15, 2023):

In my understanding, by default, Nginx will create a directory if it doesn't exist. However, it will only create the last directory in the path. For example, if my cache path is

/home/nginx/cache

and the cache directory does not exist, Nginx will create it. However, if both the nginx and cache directories do not exist, Nginx will return an error:

[emerg] mkdir() No such file or directory) nginx

Yes I understand, I want to use os.MkdirAll function, which can create a directory named path, along with any necessary parents.

<!-- gh-comment-id:1857247863 --> @0xJacky commented on GitHub (Dec 15, 2023): > In my understanding, by default, Nginx will create a directory if it doesn't exist. However, it will only create the last directory in the path. For example, if my cache path is > > `/home/nginx/cache` > > and the cache directory does not exist, Nginx will create it. However, if both the nginx and cache directories do not exist, Nginx will return an error: > > `[emerg] mkdir() No such file or directory) nginx` Yes I understand, I want to use os.MkdirAll function, which can create a directory named path, along with any necessary parents.
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#1469
No description provided.