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:
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
在构建过程中没有错误,并且使用Docker-Compose-Verbose标志也不会产生任何有用的信息。我尝试了一些不同级别的杂语,并尝试了完全限定复制命令的第一个参数 - 既没有任何更改。
我做错了什么?
thanks对 @dave_thompson_085的评论表示,指出docker-compose中的
/etc/nginx/conf.d/default.conf
和
build
是不相容的,我意识到解决方案是更新我的docker-compose.yml文件以通过卷复制vhost。
image