首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何创建带有坞-撰写的LEMP堆栈?

如何创建带有坞-撰写的LEMP堆栈?
EN

Stack Overflow用户
提问于 2017-11-01 13:02:39
回答 1查看 1.2K关注 0票数 0

我想为本地web开发创建一个带有docker-组合的LEMP堆栈,但我遇到了一些麻烦……

我编写的配置文件:

docker-compose.yml

代码语言:javascript
复制
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

mysite.template

代码语言:javascript
复制
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;
        }
}

问题是,当我试图打开http://localhost:8080时,结果是拒绝访问

我怎么才能修好它?

编辑:

这是nginx容器错误日志:

代码语言:javascript
复制
nginx_1  | 2017/11/01 13:21:25 [error] 8#8: *1 FastCGI sent in stderr: "Access to the script '/web' has been denied (see security.limit_extensions)" while reading response header from upstream
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-11-01 13:56:57

通过将docker-compose.yml更改为:

代码语言:javascript
复制
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
票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/47055520

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档