Flarum BBS System(2)Docker the BBS

dusuanyun 2018-11-20

FlarumBBSSystem(2)DockertheBBS

ChangePHPtoversion7.1.24inDocker,itseemseverythingworksfine.

StepstogeneratethelatestPHPProject

Intheworkingdirectory

>mkdirflarum

>cdflarum/

>composercreate-projectflarum/flarum.--stability=beta

Itseemsweneedexecutethecommandtoinstallthedependency

>composerinstall

HereistheDockerRelatedConfiguration

CommandtoexecutethePHPandNginxinstart.sh

#!/bin/sh-ex

cd/tool/php-7.1.24

sbin/php-fpm-R

cd/tool/nginx-1.14.0

sbin/nginx-g"daemonoff;"

Makefiletooperateallthestepstobuildtheimage

PORT=8081

IMAGE=sillycat/public

TAG=centos7-flarum

NAME=centos7-flarum-$(PORT)

prepare:

wgethttp://am1.php.net/distributions/php-7.1.24.tar.gz-Pinstall/

wgethttps://nginx.org/download/nginx-1.14.0.tar.gz-Pinstall/

docker-context:

build:docker-context

dockerbuild-t$(IMAGE):$(TAG).

run:

dockerrun-d-p$(PORT):80-v$(shellpwd)/html:/tool/nginx-1.14.0/html--name$(NAME)$(IMAGE):$(TAG)

debug:

dockerrun-ti-p$(PORT):80-v$(shellpwd)/html:/tool/nginx-1.14.0/html--name$(NAME)$(IMAGE):$(TAG)/bin/bash

clean:

dockerstop${NAME}

dockerrm${NAME}

logs:

dockerlogs${NAME}

publish:

dockerpush${IMAGE}

StepstobuildImageintheDockerfile

#SetUpPHPFPM

#PrepretheOS

FROMcentos:7

MAINTAINERCarlLuo<[email protected]>

#installthesoftwarea

RUNyum-yupdate

RUNyuminstall-ywgetgccmake

RUNyuminstall-yopenssl-devel

RUNyuminstall-yzlib-develpcre-devel

RUNyum-yinstalllibxml2-develcurl-devellibjpeg-devellibpng-develfreetype-develfreetype

#installPHP

RUNmkdir-p/tool

RUNmkdir-p/install

ADDinstall/php-7.1.24.tar.gz/install/

WORKDIR/install/php-7.1.24

RUN./configure--prefix=/tool/php-7.1.24--enable-fpm--with-fpm-user=root--with-fpm-group=root--with-mysqli--with-pdo-mysql--with-iconv-dir--with-freetype-dir--with-jpeg-dir--with-png-dir--with-zlib--with-libxml-dir=/usr--enable-xml--disable-rpath--enable-bcmath--enable-shmop--enable-sysvsem--enable-inline-optimization--with-curl--enable-mbregex--enable-mbstring--enable-ftp--with-gd--with-openssl--with-mhash--enable-pcntl--enable-sockets--with-xmlrpc--enable-zip--enable-soap--without-pear--with-gettext--enable-fileinfo--enable-maintainer-zts

RUNmake

RUNmakeinstall

#configPHP

ADDconf/www.conf/tool/php-7.1.24/etc/php-fpm.d/

ADDconf/php-fpm.conf/tool/php-7.1.24/etc/

#installnginx

ADDinstall/nginx-1.14.0.tar.gz/install/

WORKDIR/install/nginx-1.14.0

RUN./configure--prefix=/tool/nginx-1.14.0

RUNmake

RUNmakeinstall

#confignginx

ADDconf/nginx.conf/tool/nginx-1.14.0/conf/

RUNchmod-R777/tool/nginx-1.14.0/html/

#starttheapplication

EXPOSE80

RUNmkdir-p/app/

ADDstart.sh/app/

WORKDIR/app/

CMD["./start.sh"]

Thenginx.conftoconfiguretheflarumproject

userrootroot;

worker_processes1;

events{

worker_connections1024;

}

http{

includemime.types;

default_typeapplication/octet-stream;

sendfileon;

keepalive_timeout65;

#gzipon;

server{

listen80;

server_namekikokang.ddns.net;

root/tool/nginx-1.14.0/html/flarum;

indexindex.phpindex.htmlindex.htm;

location/{

try_files$uri$uri//index.php?$query_string;

}

location/api{

try_files$uri$uri//api.php?$query_string;

}

location/admin{

try_files$uri$uri//admin.php?$query_string;

}

location/flarum{

denyall;

return404;

}

error_page500502503504/50x.html;

location=/50x.html{

roothtml;

}

#passthePHPscriptstoFastCGIserverlisteningon127.0.0.1:9000

#

location~\.php${

fastcgi_split_path_info^(.+.php)(/.+)$;

fastcgi_pass127.0.0.1:9000;

includefastcgi_params;

fastcgi_paramSCRIPT_FILENAME$document_root$fastcgi_script_name;

fastcgi_paramHTTP_PROXY"";

fastcgi_indexindex.php;

}

location~*\.html${expires-1;}

location~*\.(css|js|gif|jpe?g|png)${

expires1M;

add_headerPragmapublic;

add_headerCache-Control"public,must-revalidate,proxy-revalidat";

}

gzipon;

gzip_http_version1.1;

gzip_varyon;

gzip_comp_level6;

gzip_proxiedany;

gzip_typesapplication/atom+xml

application/javascript

application/json

application/vnd.ms-fontobject

application/x-font-ttf

application/x-web-app-manifest+json

application/xhtml+xml

application/xml

font/opentype

image/svg+xml

image/x-icon

text/css

#text/html--text/htmlisgzippedbydefaultbynginx

text/plain

text/xml;

gzip_buffers168k;

gzip_disable"MSIE[1-6]\.(?!.*SV1)";

}

}

Theimportantthingistochangethefileinhtml/flarum/config.php,changetheURLtoyourdomain

'url'=>'https://kikokang.ddns.net’,

ButIthinkthisissetupbythefirststepwhenyouputyourdatabaseinformationthere.

HowtoSetupTheEmail

Firstlogininasadmin,onthedropdownmenu,choose‘adminitrator’—>Email,hereisoneexampleforGMAIL

SMTPServer

Driver:smtp

Host:smtp.gmail.com

Port:465

Encryption:ssl

SMTPAccount:

Username:[email protected]

Password:xxxxx

Addresses:

Sender:[email protected]

Ifollowedthisdiscussion

https://discuss.flarum.org/d/4979-sign-up-and-email-not-working/28

Youneedtogotoyourgmail.Clickon‘Account’—>“Sign-in&security”—>Appswithaccountaccess—>“Allowlesssecureapps:ON"

Youmayneedtocheckyoursecurityalertemailstoconfirmyouaretheonewhoattempttologinaswell.

References:

EmailConfiguration

https://discuss.flarum.org/d/879-how-do-i-change-email-settings-to-gmail-smtp/3

相关推荐