docker配置:

version: '3.8'

services:
  # 1. 数据库服务 (MySQL 8.0)
  db:
    image:  mariadb:10.6
    container_name: xiuno-db
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: 123456
      MYSQL_DATABASE: xiunobbs
      MYSQL_USER: root
      MYSQL_PASSWORD: 123456
    volumes:
      - ./db_data:/var/lib/mysql  # 数据持久化,防止容器删除后数据丢失
    ports:
      - "3307:3306"  # 将 3306 暴露出来,这样 PHP 可以直接通过群晖 IP 连进去

    command: 
      - --character-set-server=utf8mb4
      - --collation-server=utf8mb4_unicode_ci
      - --default-authentication-plugin=mysql_native_password

  # 2. PHP 服务 (XIUNOX 运行环境)
  php:
    image: php:8.2-fpm-alpine
    container_name: xiuno-php
    restart: always
    volumes:
      - ./www:/var/www/html  # 挂载 XIUNOX 源码
    depends_on:
      - db

    entrypoint: >
      sh -c "sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories && 
             apk add --no-cache freetype-dev libjpeg-turbo-dev libpng-dev && 
             docker-php-ext-configure gd --with-freetype --with-jpeg && 
             docker-php-ext-install -j$$(nproc) pdo_mysql mysqli gd && 
             docker-php-entrypoint php-fpm"
  # 3. Web 服务器 (Nginx)
  nginx:
    image: nginx:alpine
    container_name: xiuno-nginx
    restart: always
    ports:
      - "8080:80"  # 宿主机端口:容器端口,若冲突可改为 8081:80
    volumes:
      - ./www:/var/www/html
      - ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro # 挂载 Nginx 配置
    depends_on:
      - php

nginx配置

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;

events {
    worker_connections 1024;
}

http {
    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    log_format main '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"@http_user_agent" "$http_x_forwarded_for"';

    access_log /var/log/nginx/access.log main;
    sendfile on;
    keepalive_timeout 65;

    # 您的网站服务器配置必须在这里面
    server {
        listen 80;
        server_name localhost;
        root /var/www/html;
        index index.php index.html index.htm;

        # XIUNOX 伪静态规则
        location / {
            try_files $uri $uri/ /index.php?$query_string;
        }

        # 转发请求给 PHP-FPM 容器
        location ~ \.php$ {
            try_files $uri =404;
            fastcgi_pass xiuno-php:9000;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME /var/www/html/$fastcgi_script_name;
            include fastcgi_params;
            
            fastcgi_buffer_size 128k;
            fastcgi_buffers 4 256k;
            fastcgi_busy_buffers_size 256k;
        }
    }
}