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

Support for cache configuration #236

Open
sanvu88 opened this issue Dec 13, 2023 · 3 comments
Open

Support for cache configuration #236

sanvu88 opened this issue Dec 13, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@sanvu88
Copy link
Contributor

sanvu88 commented Dec 13, 2023

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.

@sanvu88 sanvu88 added the enhancement New feature or request label Dec 13, 2023
@0xJacky
Copy link
Owner

0xJacky commented 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.

@sanvu88
Copy link
Contributor Author

sanvu88 commented 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

@0xJacky
Copy link
Owner

0xJacky commented 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 up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants