1. 配置linux

  
	upstream discuz {
		server 192.0.0.1:6000weight=10 max_fails=3     fail_timeout=30s;
	}
	
	
    server {
        listen       80;
        server_name  bbs.xxxx.com;
		proxy_set_header X-Forwarded-Host $host;
		proxy_set_header X-Forwarded-Server $host;
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 
	 location / {
	    add_header Cache-Control no-cache;
	    proxy_set_header   Host bbs.xxxx.com;
	    proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
	    proxy_set_header   X-Real-IP        $remote_addr;
	    proxy_pass         http://discuz;
	    proxy_connect_timeout 30s;
	}  
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        } 
    }
    
  
    server {
        listen 6000;
		server_name  localhost;
		
		location / {
			root /var/www/Discuz_X3.5_SC_UTF8_20231001;
			index index.html index.htm index.php;
		}
		
		error_page   500 502 503 504  /50x.html;
		location = /50x.html {
			root   /usr/share/nginx/html;
		}

		location ~ \.php$ {
			fastcgi_pass   192.0.0.1:5100; # PHP容器的 域名和端口
			fastcgi_index  index.php;
			fastcgi_param  SCRIPT_FILENAME /var/www/html$fastcgi_script_name;  # PHP容器的项目路径
 			include        fastcgi_params; 
		}
    }

2.新增:docker-compose-discuz.yml

version: "3.9"
services:
  php:
    image: php:7.4.27-fpm
    volumes:
    - /etc/localtime:/etc/localtime
    - /usr/local/php-disucz/php:/usr/local/etc/php
    - /var/www/Discuz_X3.5_SC_UTF8_20231001:/var/www/html
    ports:
    - "5100:9000"
    restart: always
    environment:
      NEW_UID: 1000
      NEW_GID: 1000

注意:

先注释了– /usr/local/php-disucz/php:/usr/local/etc/php,启动进入容器执行以下命令

docker cp 容器id:/usr/local/etc/php/php.ini-development  /usr/local/php-disucz/php/php.ini

修改/usr/local/php-disucz/php/php.ini 放开 extension=mysqli

,然后再放开红色框的内容再重新启动容器


3.安装mysqli

docker-php-ext-install mysqli

4. 重启

docker restart 容器ID