Next revision | Previous revision |
servers:windows:nginx:mybb [2025/09/27 10:58] – created Sean Rhone | servers:windows:nginx:mybb [2025/10/11 09:15] (current) – Sean Rhone |
---|
====== Information ====== | ====== Information ====== |
| |
* MyBB | * MyBB ((https://mybb.com/)) |
* [[information:realm_of_espionage|Realm of Espionage]] | * [[information:realm_of_espionage|Realm of Espionage]] |
* https://forums.realmofespionage.xyz | * https://forums.realmofespionage.xyz |
* 2025/09/27: WIP | |
| |
===== Prerequisites ===== | ===== Prerequisites ===== |
| |
* [[linux:distros:server:opensuse_tumbleweed_server|openSUSE Tumbleweed (Server)]] | * [[windows;11_ltsc_server|Windows 11 (24H2)]] |
* [[servers:linux:nginx_php_php-fpm|nginx + PHP + PHP-FPM]] | * [[servers;windows;nginx_php_php-cgi|nginx + PHP + PHP-CGI]] |
* [[servers:linux:nginx:lets_encrypt|Certbot (Let's Encrypt)]] | * [[servers;windows;nginx;lets_encrypt|Certbot (Let's Encrypt)]] |
* [[servers:linux:mariadb|MariaDB]] | * [[programs;windows;git|Git]] |
| * [[servers;windows;mariadb|MariaDB]] |
| |
| |
| * TODO: ''listen = "127.0.0.1:9006"'' |
| |
====== Dependencies ====== | ====== Dependencies ====== |
* https://docs.mybb.com/1.8/install/requirements/ | * https://docs.mybb.com/1.8/install/requirements/ |
* https://docs.mybb.com/1.8/install/anonymous-statistics/ | * https://docs.mybb.com/1.8/install/anonymous-statistics/ |
| |
sudo zypper install php-composer2 | |
| |
====== Download Source ====== | ====== Download Source ====== |
* https://github.com/mybb/mybb/commits/dev-1.9/ | * https://github.com/mybb/mybb/commits/dev-1.9/ |
| |
sudo git clone --branch 'dev-1.9' --depth '1' --recurse-submodules 'https://github.com/mybb/mybb.git' '/srv/www/forum' && sudo chown -R 'wwwrun':'www' '/srv/www/forum' && sudo chmod -R '0755' '/srv/www/forum' | "%ProgramFiles%\Git\bin\git.exe" clone --branch "dev-1.9" --depth "1" --recurse-submodules "https://github.com/mybb/mybb.git" "%SystemDrive%\www\forum" |
| |
| ====== Database ====== |
| |
| "%ProgramFiles%\MariaDB 12.1\bin\mariadb.exe" -u "root" -p |
| |
| CREATE DATABASE mybb; |
| |
| CREATE USER 'mybb'@'localhost' IDENTIFIED BY 'x'; |
| |
| GRANT ALL PRIVILEGES ON mybb.* to 'mybb'@'localhost'; |
| |
| FLUSH PRIVILEGES; |
| |
| EXIT |
| |
====== Environment ====== | ====== Environment ====== |
| |
* https://github.com/mybb/mybb/wiki/Getting-started-with-MyBB-1.9-development---Composer | ===== PHP ===== |
| |
===== Composer ===== | "notepad.exe" "%SystemDrive%\www\php\forum.ini" |
| |
sudo su 'wwwrun' -s '/bin/bash' | <code> |
| [PHP] |
| ; Modules |
| extension_dir = ".\ext" |
| extension = "curl" |
| extension = "gd" |
| extension = "intl" |
| extension = "ldap" |
| extension = "mysqli" |
| extension = "openssl" |
| extension = "sodium" |
| |
cd '/tmp' && composer --working-dir='/srv/www/forum' --no-cache install --no-dev | ; Settings |
| post_max_size = "5M" |
| upload_max_filesize = "5M" |
| error_reporting = "E_ERROR" |
| display_errors = "Off" |
| |
exit | [Date] |
| date.timezone = "America/New_York" |
| |
====== Database ====== | ; End</code> |
| |
sudo mariadb | "php.exe" -c "%SystemDrive%\www\php\forum.ini" -m |
| |
CREATE DATABASE mybb; | ===== Composer ===== |
| |
CREATE USER 'mybb'@'localhost' IDENTIFIED BY 'x'; | * https://github.com/mybb/mybb/wiki/Getting-started-with-MyBB-1.9-development---Composer |
| * [[https://github.com/composer/composer/releases/latest/download/composer.phar|composer.phar]] |
| |
GRANT ALL PRIVILEGES ON mybb.* to 'mybb'@'localhost'; | MKDIR "%SystemDrive%\www\ext" |
| |
FLUSH PRIVILEGES; | "%SystemDrive%\www\ext\composer.phar" |
| |
EXIT | "php.exe" -c "%SystemDrive%\www\php\forum.ini" "%SystemDrive%\www\ext\composer.phar" --version |
| |
| CD "%SystemDrive%\www\forum" && "php.exe" -c "%SystemDrive%\www\php\forum.ini" "%SystemDrive%\www\ext\composer.phar" install --no-dev |
| |
====== nginx + PHP-FPM Configuration ====== | ====== nginx + PHP-FPM Configuration ====== |
| |
# End</code> | # End</code> |
| |
| ====== Scripts ====== |
| |
| ===== Back-up ===== |
| |
| * TODO |
| |
| "notepad.exe" "%SystemDrive%\www\scripts\media\Back-up.bat" |
| |
| <code> |
| @echo off |
| |
| :: User\Downloads |
| "tar.exe" -czf "%UserProfile%\Downloads\dokuwiki-files-auto-%RANDOM%.tar.gz" -C "%SystemDrive%\www\wiki" "data/pages" "data/meta" "data/media" "data/media_meta" "data/attic" "data/media_attic" "conf" |
| |
| :: NAS |
| ::"tar.exe" -czf "D:\Servers\Scheduled Backups\dokuwiki-files-auto-%RANDOM%.tar.gz" -C "%SystemDrive%\www\wiki" "data/pages" "data/meta" "data/media" "data/media_meta" "data/attic" "data/media_attic" "conf" |
| |
| :: End</code> |
| |
| "%SystemDrive%\www\scripts\media\Back-up.bat" |
| |
| ===== Maintenance ===== |
| |
| "notepad.exe" "%SystemDrive%\www\scripts\media\Maintenance.bat" |
| |
| <code> |
| @echo off |
| |
| :: Piwigo |
| "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\media" reset --hard |
| |
| "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\media" gc --aggressive --prune="all" |
| "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\media" fsck --full --strict |
| |
| :: Bootstrap Darkroom |
| "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\media\themes\bootstrap_darkroom" reset --hard |
| |
| "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\media\themes\bootstrap_darkroom" gc --aggressive --prune="all" |
| "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\media\themes\bootstrap_darkroom" fsck --full --strict |
| |
| :: End</code> |
| |
| "%SystemDrive%\www\scripts\media\Maintenance.bat" |
| |
| ===== Git Fix ===== |
| |
| * :!: Set email for ''user.email'' |
| |
| "notepad.exe" "%SystemDrive%\www\scripts\forum\Git Fix.bat" |
| |
| <code> |
| @echo off |
| |
| RMDIR /S /Q "%SystemDrive%\www\forum\.git" |
| |
| "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\forum" init --initial-branch="dev-1.9" |
| "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\forum" add "." |
| "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\forum" config "user.email" "espionage724@x" |
| "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\forum" commit --message="x" |
| |
| "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\forum" remote add "origin" "https://github.com/mybb/mybb.git" |
| "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\forum" pull --depth "1" --recurse-submodules "origin" "dev-1.9" --rebase |
| "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\forum" reset --hard "origin/dev-1.9" |
| |
| "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\forum" gc --aggressive --prune="all" |
| "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\forum" fsck --full --strict |
| |
| PAUSE |
| |
| :: End</code> |
| |
| "%SystemDrive%\www\scripts\forum\Git Fix.bat" |
| |
====== Initial Setup ====== | ====== Initial Setup ====== |
sudo systemctl start 'forum-m' && sudo systemctl status 'forum-m' -l | sudo systemctl start 'forum-m' && sudo systemctl status 'forum-m' -l |
| |
====== Backup ====== | ====== Files ====== |
| |
===== Files ===== | ===== Backup ===== |
| |
**** | **** |
| |
sudo tar -czf ~/'mybb-files-manual-'$(date +%Y-%m-%d)'.tar.gz' -C '/srv/www' 'forum' | "tar.exe" -czf "%UserProfile%\Downloads\mybb-files-manual-%RANDOM%.tar.gz" -C "%SystemDrive%\www" "forum" |
| |
===== Database ===== | ====== Database ====== |
| |
**** | ===== Backup ===== |
| |
sudo mariadb-dump --single-transaction --quick 'mybb' -r ~/'mybb-database-manual-'$(date +%Y-%m-%d)'.sql' | |
| |
===== scp ===== | |
| |
scp espionage724@192.168.1.152:~/'mybb-files-'*'.tar.gz' ~/'Downloads' | |
| |
scp espionage724@192.168.1.152:~/'mybb-database-'*'.sql' ~/'Downloads' | |
| |
====== Restore ====== | |
| |
===== scp ===== | |
| |
scp ~/'Downloads/mybb-files-'*'.tar.gz' espionage724@192.168.1.152:~ | |
| |
scp ~/'Downloads/mybb-database-'*'.sql' espionage724@192.168.1.152:~ | |
| |
===== Stop nginx ===== | |
| |
**** | **** |
| |
sudo systemctl stop 'nginx' | CD "%UserProfile%\Downloads" && "%ProgramFiles%\MariaDB 12.1\bin\mariadb-dump.exe" -u "root" -p --opt -r "mybb.sql" "mybb" |
| |
===== Remove Existing Files ===== | ===== Restore ===== |
| |
**** | |
| |
ls ~/'mybb-files-'*'.tar.gz' && sudo rm -Rf '/srv/www/forum' | |
| |
===== Restore Files ===== | |
| |
**** | |
| |
sudo tar -xzf ~/'mybb-files-'*'.tar.gz' -C '/srv/www' 'forum' && sudo chown -R 'wwwrun':'www' '/srv/www/forum' && sudo chmod -R '0755' '/srv/www/forum' | |
| |
===== Git Fix ===== | |
| |
sudo su 'wwwrun' -s '/bin/bash' | |
| |
cd '/srv/www/forum' | |
| |
rm -Rf '.git' | |
| |
git init -b 'dev-1.9' | |
| |
git add '.' | |
| |
git commit -m 'x' | |
| |
exit | |
| |
===== Restore Database ===== | |
| |
* [[#database|Initial set-up]] | * [[#database|Initial set-up]] |
| |
sudo mariadb --execute='DROP DATABASE mybb;' | "%ProgramFiles%\MariaDB 12.1\bin\mariadb.exe" -u "root" -p --execute="CREATE DATABASE mybb" |
| |
sudo mariadb --execute='CREATE DATABASE mybb;' | |
| |
sudo mariadb 'mybb' < ~/'mybb-database-'*'.sql' | |
| |
===== Start nginx ===== | |
| |
**** | |
| |
sudo systemctl start 'nginx' | |
| |
===== Clean-up ===== | |
| |
**** | |
| |
rm -fv ~/'mybb-files-'*'.tar.gz' ~/'mybb-database-'*'.sql' | "%ProgramFiles%\MariaDB 12.1\bin\mariadb.exe" -u "root" -p "mybb" < "%UserProfile%\Downloads\mybb.sql" |
| |