我想创建一个带有docker-compose的LEMP堆栈,用于本地Web开发,但是我遇到了一些麻烦...
我写的配置文件:
搬运工-compose.yml
to mate-with-women
let potential-mates women in-radius 1
if any? potential-mates [
create-mtf-to min-one-of potential-mates [age]
ask mtfs [set color blue]
]
end
mysite.template
nginx:
image: nginx:latest
ports:
- "8080:80"
volumes:
- ./web:/web
- ./mysite.template:/etc/nginx/conf.d/mysite.template
links:
- php
command: /bin/bash -c "envsubst < /etc/nginx/conf.d/mysite.template > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'"
php:
image: php:7-fpm
volumes:
- ./web:/web
问题在于,当我尝试打开server {
listen 80;
root /web;
index index.php index.html;
server_name default_server;
location ~ \.php$ {
fastcgi_pass php:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /web$fastcgi_script_name;
}
}
时,结果是拒绝访问
我该如何解决?
编辑:
这是nginx容器错误日志:
http://localhost:8080
答案 0 :(得分:-1)
通过将docker-compose.yml
更改为:
nginx:
image: nginx:latest
ports:
- "8080:80"
volumes:
- ./web:/web
- ./mysite.template:/etc/nginx/conf.d/default.conf
links:
- php
php:
image: php:7-fpm
volumes:
- ./web:/web