自建Docker bbs修罗论坛 xiuno
date
Oct 25, 2022
slug
newservice-bbs-xiuno
status
Published
summary
新服务 论坛
tags
service
type
Post
Summary步骤修改.env修改 docker-compose.yml修改nginx/default.conf修改php-fpmlocal cache / cloudflare cache都要关闭,不然安装会有各种问题CloudFlare设立新的域名npm nginx proxy manager配置优化打开伪静态不同的前台风格验证
Summary
- ‣
步骤
export DOCKER_PROJ=xiuno_ck
mkdir /data/$DOCKER_PROJ; cd /data/$DOCKER_PROJ
git clone https://github.com/wanghaiwei/xiuno-docker.git
cd xiuno-docker
wget https://github.com/jiix/xiunobbs/releases/download/v4.0.7/xiunobbs-v4.0.7.zip
unzip xiunobbs-v4.0.7.zip && mv xiunobbs-4.0.7 xiuno
修改.env
# docker inspect npm_nginx_proxy_manager-network | grep -i Subnet
cp .env.example .env && vi .env
# define env var default value
MYSQL_ROOT_PASSWORD=123456
MYSQL_USER=xiuno
MYSQL_PASSWORD=123456
NGINX_PORT=8018
MYSQL_SERVER_ADDRESS=xiuno-mysql
#MYSQL_SERVER_ADDRESS=10.10.100.1
DOCKER_NET=192.168.80.0/20
#DOCKER_NET=10.10.0.1/16
修改 docker-compose.yml
version: '3.4'
services:
xiuno-nginx:
build: ./nginx
image: nginx:volume-fixed-latest
# 端口映射
ports:
- "$NGINX_PORT:80"
# 依赖关系 先跑php
depends_on:
- "xiuno-php-fpm"
# 数据卷
volumes:
- "$PWD/xiuno:/var/www/html"
links:
- xiuno-php-fpm
- xiuno-mysql
# 容器名称
container_name: "xiuno-nginx"
xiuno-php-fpm:
build: ./php-fpm
# image指定build Dockerfile生成镜像的名称
image: php:fpm-mysqli-latest
expose:
- "9000"
volumes:
- "$PWD/xiuno:/var/www/html"
container_name: "xiuno-php-fpm"
xiuno-mysql:
build: ./mysql
image: mysql:fixed-auth-latest
expose:
- "3306"
# 环境变量
environment:
# mysql密码
- MYSQL_ROOT_PASSWORD
- MYSQL_USER
- MYSQL_PASSWORD
volumes:
- "$PWD/mysql/data:/var/lib/mysql"
container_name: "xiuno-mysql"
networks:
default:
name: npm_nginx_proxy_manager-network
external: true
修改nginx/default.conf
修改php-fpm
# 如果修改了任何文件,需要rebuild
docker compose build
docker-compose down; docker-compose up -d; sleep 1s; docker-compose logs -f
local cache / cloudflare cache都要关闭,不然安装会有各种问题
CloudFlare设立新的域名
npm nginx proxy manager配置
优化
打开伪静态
location ~* \.(htm)$ {
rewrite "^(.*)/(.+?).htm(.*?)$" $1/index.php?$2.htm$3 last;
}