Answer the question
In order to leave comments, you need to log in
How to correctly configure sending files from the container directly through nginx?
In one of my projects, the following situation turned out:
I have a media/folder1/ folder containing files from various service and user folders. It has a media/folder1/folder_for_nginx/ folder, which contains files that need to be given to the user directly through nginx.
I added the folder1 folder to the repository in the media folder and the folder_for_nginx folder in it, each of them contains a .gitignore file with the contents:
# Ignore everything in this directory
*
# Except this file
!.gitignore
project_stage:
...
volumes:
- ./folder_for_nginx:/usr/src/api/media/folder1/folder_for_nginx
...
nginx_stage:
...
volumes:
- ./folder_for_nginx:/usr/src/folder_for_nginx
...
...
server {
...
location /files/ {
alias /usr/src/folder_for_nginx/;
autoindex off;
}
...
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question