问题描述 投票:0回答:0

services: web-nginx: container_name: web-nginx image: nginx:1.21.0 build: context: ./ dockerfile: ./docker/nginx/Dockerfile networks: - mosho ports: - '8080:80' volumes: - ./public:/var/www/public networks: mosho:

我的Dockerfile具有:

FROM nginx COPY vhost.conf /etc/nginx/conf.d/default.conf
我的vhost.conf有:

server { listen 80; index index.php index.html; root /var/www/public; location / { try_files $uri /index.php?$args; } location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass runtime:9000; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; } }
当执行

docker-compose up -d

然后询问该文件时,我希望看到上面的vhost.conf文件,但是我只是看到默认的nginx vhost。
在构建过程中没有错误,并且使用Docker-Compose-Verbose标志也不会产生任何有用的信息。
我尝试了一些不同级别的杂语,并尝试了完全限定复制命令的第一个参数 - 既没有任何更改。

我做错了什么?

	
thanks对 @dave_thompson_085的评论表示,指出docker-compose中的

/etc/nginx/conf.d/default.conf

build
是不相容的,我意识到解决方案是更新我的docker-compose.yml文件以通过卷复制vhost。
image

docker nginx docker-compose
最新问题
© www.soinside.com 2019 - 2025. All rights reserved.