从github换到flarum,捣鼓了下,记录一些问题。

使用的docker安装的,比较省事,直接pull下来处理就行了,下面是相关配置文件

docker-compose.yml

version: "3"

services:
  flarum:
    image: registry.cn-hangzhou.aliyuncs.com/flarumchina/nginx-flarum:latest
    container_name: flarum
    ports:
      - 80:8888
      - 443:443
    env_file:
      - ./flarum.env
    volumes:
      - ./assets:/flarum/app/public/assets
      - ./extensions:/flarum/app/extensions
      - ./nginx:/etc/nginx/conf.d
      - ./cert:/etc/nginx/cert
      - ./nginx.conf:/etc/nginx/nginx.conf
    depends_on:
      - mysql
    restart: always

  mysql:
    image: mysql:5.7
    container_name: flarum-mysql
    ports:
      - 3306:3306
    environment:
      - MYSQL_ROOT_PASSWORD=root password
      - MYSQL_DATABASE=flarum
      - MYSQL_USER=flarum
      - MYSQL_PASSWORD=your password
    volumes:
      - ./db:/var/lib/mysql
    restart: always

因为使用了ssl,所以配置了证书,nginx配置如下

nginx.conf

worker_processes auto;
pid /tmp/nginx.pid;
daemon off;

events {
  worker_connections 1024;
  use epoll;
}

http {

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

  access_log off;
  error_log /tmp/ngx_error.log error;

  sendfile on;
  keepalive_timeout 15;
  keepalive_disable msie6;
  keepalive_requests 100;
  tcp_nopush on;
  tcp_nodelay on;
  server_tokens off;

  fastcgi_temp_path /tmp/fastcgi 1 2;
  client_body_temp_path /tmp/client_body 1 2;
  proxy_temp_path /tmp/proxy 1 2;
  uwsgi_temp_path /tmp/uwsgi 1 2;
  scgi_temp_path /tmp/scgi 1 2;

  server {
    listen 8888;
    server_name hmilyld.com www.hmilyld.com; 
    rewrite ^(.*)$ https://$host$1 permanent; 
    location / {
      index index.php index.html index.htm;
    }
  }

  server {
    listen 443 ssl; 
    server_name hmilyld.com www.hmilyld.com; 
    charset utf-8;

    root /flarum/app/public;
    index index.php;
    ssl_certificate cert/your.pem; #将your.pem替换成您证书的文件名。
    ssl_certificate_key cert/your.key; #将your.key替换成您证书的密钥文件名。
    ssl_session_timeout 5m;
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; 
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2; 
    ssl_prefer_server_ciphers on;
    
    include /flarum/app/.nginx.conf;
    
    location ~* \.php$ {
      try_files $uri =404;
      include fastcgi_params;
      fastcgi_split_path_info ^(.+\.php)(/.*)$;
      fastcgi_index index.php;
      fastcgi_pass unix:/tmp/php-fpm.sock;
      fastcgi_intercept_errors on;
      fastcgi_request_buffering off;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      fastcgi_param PATH_INFO $fastcgi_path_info;
      fastcgi_param HTTP_PROXY "";
      fastcgi_param REMOTE_ADDR $http_x_real_ip;
    }
    
    include /etc/nginx/conf.d/custom-vhost-flarum.conf;
  }
}

flarum.env

DEBUG=false
FORUM_URL=https://test.com
FORUM_CDN=https://test.com 

# Database configuration
DB_HOST=flarum-mysql
DB_NAME=flarum
DB_USER=your user
DB_PASS=your pass
DB_PREF=flarum_
DB_PORT=3306

# User admin flarum (environment variable for first installation)
# /!\ admin password must contain at least 8 characters /!\
FLARUM_ADMIN_USER=your flarum user
FLARUM_ADMIN_PASS=your flarum pass
FLARUM_ADMIN_MAIL=your email
FLARUM_TITLE=title

启动/停止

docker-compose up -d
docker-compose down

问题

stmp邮件发送异常

检查smtp配置是否正确,同时注意,如果服务器在阿里云或腾讯云,检查是否出站规则是否放行了相关端口,如果是其他vps,检查防火墙设置

标签: docker, flarum

添加新评论