首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >通过非Docker NGINX提供docker PHP FPM内容

通过非Docker NGINX提供docker PHP FPM内容
EN

Server Fault用户
提问于 2021-04-08 22:10:48
回答 1查看 1.2K关注 0票数 0

我正在尝试使用Docker运行MyBB论坛软件,以便在我的服务器上运行NGINX,运行NGINX,为其他内容提供服务。

这就是我的docker-compose.yml目前的样子(我已经改变和测试了一段时间.):

代码语言:javascript
复制
services:
  mybb:
    image: mybb/mybb:latest
    volumes:
    - ${PWD}/mybb:/var/www/html:rw
    ports:
      - "9000:9000"

  postgresql:
    environment:
      POSTGRES_DB: mybb
      POSTGRES_PASSWORD: password
      POSTGRES_USER: mybb
    image: postgres:13.2-alpine
    volumes:
    - ${PWD}/postgres/data:/var/lib/postgresql/data:rw

version: '3.7'

这个特定域的NGINX配置文件如下所示:

代码语言:javascript
复制
upstream mybb {
    server 172.20.0.2:9000 weight=5;
}

server {
    listen 80;
    listen [::]:80;

    root /home/lobo/mybb_docker/mybb;
    index index.html index.php;

    server_name mydomain.com www.mydomain.com;

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ inc/ {
        internal;
    }

    location ~ ^/(images|cache|jscripts|uploads)/ {
        access_log off;
    }

    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass mybb;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
    }
}

我也在这里换东西..。我试过不同的IP地址:127.0.0.1:90000.0.0.0:9000.

但我不能让它起作用。当我访问该网站时,它只返回:File not found.

我是不是做错了什么事?还有什么我可以试试的吗?

谢谢你!!

编辑:添加/var/log/nginx/error.log

代码语言:javascript
复制
2021/04/09 10:04:56 [error] 19714#19714: *3705 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: xx.xx.xx.xx, server: mydomain.com, request: "GET / HTTP/1.1", upstream: "fastcgi://172.20.0.2:9000", host: "www.mydomain.com"
EN

回答 1

Server Fault用户

回答已采纳

发布于 2021-04-19 05:07:18

容器所看到的目录结构可能与运行Nginx的主机上的目录结构不同,这使得SCRIPT_FILENAME和PATH_INFO无效。

票数 0
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/1059824

复制
相关文章

相似问题

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