我正在尝试使用Docker运行MyBB论坛软件,以便在我的服务器上运行NGINX,运行NGINX,为其他内容提供服务。
这就是我的docker-compose.yml目前的样子(我已经改变和测试了一段时间.):
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配置文件如下所示:
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:9000,0.0.0.0:9000.
但我不能让它起作用。当我访问该网站时,它只返回:File not found.
我是不是做错了什么事?还有什么我可以试试的吗?
谢谢你!!
编辑:添加/var/log/nginx/error.log:
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"发布于 2021-04-19 05:07:18
容器所看到的目录结构可能与运行Nginx的主机上的目录结构不同,这使得SCRIPT_FILENAME和PATH_INFO无效。
https://serverfault.com/questions/1059824
复制相似问题