![](/img/trans.png)
[英]azure webapp for containers docker-compose.yml referencing bitnami images
[英]How to configure docker-compose.yml and nginx conf file to read an external drive?
我在 docker 容器中有 nginx。 我docker-compose.yml
是這樣的(簡化版):
nginx:
volumes:
- /var/www/html:/www/:rw
- /media/storage:/storage/:rw
其中/var/www/html
是我的網站根目錄, /media/storage
是我的主機 (Azure) 中的外部驅動器。
現在我試圖將網站 URL example.com/downloads
指向/storage
但沒有成功。 我的nginx/conf.d/example.com.conf
如下(簡化):
server {
listen 80 default;
server_name example.com;
# this works
root /www;
index index.php;
# this get a 404 error
location /downloads{
root /storage;
}
}
但是我收到example.com/downloads
的 404 錯誤。 我在這里忘記了什么? 兩個路徑的文件權限和所有者是相同的。 我不知道錯誤的配置是在example.com.conf
還是在docker-compose.yml
。 我應該如何配置這些?
我自己使用alias /storage;
解決了這個問題alias /storage;
而不是root /storage
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.