I'm trying to run MyBB forum software with Docker to run it on my server where I already have NGINX running serving other content.
This is how my docker-compose.yml
currently looks like (I've been changing and testing stuff for a while now...):
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'
And this is how the NGINX config file for this specific domain looks like:
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;
}
}
I've been changing stuff here also... I've tried different IP addresses: 127.0.0.1:9000
, 0.0.0.0:9000
...
But I'm not able to get it to work. When I access the website it simply returns: File not found.
Is there something I'm clearly doing wrong? Or anything else I can try?
Thank you!!
EDIT: adding /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"