| Both sides previous revisionPrevious revisionNext revision | Previous revision |
| servers:windows:nginx:mybb [2025/11/29 00:25] – Sean Rhone | servers:windows:nginx:mybb [2026/01/20 15:20] (current) – [Git Fix] Sean Rhone |
|---|
| |
| * MyBB ((https://mybb.com/)) | * 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 |
| |
| ===== Prerequisites ===== | ===== Prerequisites ===== |
| |
| * [[windows;10|Windows 10 (21H2)]] | * [[windows;10_ltsc_server|Windows 10 (21H2)]] |
| * [[servers;windows;nginx_php_php-cgi|nginx + PHP + PHP-CGI]] | * [[servers;windows;nginx_php_php-cgi|nginx + PHP + PHP-CGI]] |
| * [[servers;windows;nginx;lets_encrypt|Certbot (Let's Encrypt)]] | * [[servers;windows;nginx;lets_encrypt|Certbot (Let's Encrypt)]] |
| ====== Database ====== | ====== Database ====== |
| |
| "%ProgramFiles%\MariaDB 12.2\bin\mariadb.exe" -u "root" -p | "%ProgramFiles%\MariaDB 12.2\bin\mariadb.exe" -u "root" |
| |
| CREATE DATABASE mybb; | CREATE DATABASE mybb; |
| extension = "mysqli" | extension = "mysqli" |
| |
| | log_errors = "Off" |
| error_reporting = "~E_ALL" | error_reporting = "~E_ALL" |
| display_errors = "Off" | display_errors = "Off" |
| log_errors = "Off" | display_startup_errors = "Off" |
| | html_errors = "Off" |
| |
| [Date] | [Date] |
| <code> | <code> |
| location "~" "\.(php)(/.*)?$" { | location "~" "\.(php)(/.*)?$" { |
| |
| fastcgi_split_path_info "^(.+\.(?:php))(/.*)$"; | fastcgi_split_path_info "^(.+\.(?:php))(/.*)$"; |
| fastcgi_intercept_errors "on"; | fastcgi_intercept_errors "on"; |
| |
| fastcgi_pass "127.0.0.1:9006"; | fastcgi_pass "127.0.0.1:9006"; |
| |
| } | } |
| |
| <code> | <code> |
| server { | server { |
| |
| listen "443" "ssl"; | listen "443" "ssl"; |
| http2 "on"; | http2 "on"; |
| # access_log "logs/forum-access.log"; | # access_log "logs/forum-access.log"; |
| # error_log "logs/forum-error.log"; | # error_log "logs/forum-error.log"; |
| | |
| | location "/" { |
| | rewrite "^/forum-([0-9]+)\.html$" "/forumdisplay.php?fid=$1"; |
| | rewrite "^/forum-([0-9]+)-page-([0-9]+)\.html$" "/forumdisplay.php?fid=$1&page=$2"; |
| | rewrite "^/thread-([0-9]+)\.html$" "/showthread.php?tid=$1"; |
| | rewrite "^/thread-([0-9]+)-page-([0-9]+)\.html$" "/showthread.php?tid=$1&page=$2"; |
| | rewrite "^/thread-([0-9]+)-lastpost\.html$" "/showthread.php?tid=$1&action=lastpost"; |
| | rewrite "^/thread-([0-9]+)-nextnewest\.html$" "/showthread.php?tid=$1&action=nextnewest"; |
| | rewrite "^/thread-([0-9]+)-nextoldest\.html$" "/showthread.php?tid=$1&action=nextoldest"; |
| | rewrite "^/thread-([0-9]+)-newpost\.html$" "/showthread.php?tid=$1&action=newpost"; |
| | rewrite "^/thread-([0-9]+)-post-([0-9]+)\.html$" "/showthread.php?tid=$1&pid=$2"; |
| | |
| | rewrite "^/post-([0-9]+)\.html$" "/showthread.php?pid=$1"; |
| | |
| | rewrite "^/announcement-([0-9]+)\.html$" "/announcements.php?aid=$1"; |
| | |
| | rewrite "^/user-([0-9]+)\.html$" "/member.php?action=profile&uid=$1"; |
| | |
| | rewrite "^/calendar-([0-9]+)\.html$" "/calendar.php?calendar=$1"; |
| | rewrite "^/calendar-([0-9]+)-year-([0-9]+)\.html$" "/calendar.php?action=yearview&calendar=$1&year=$2"; |
| | rewrite "^/calendar-([0-9]+)-year-([0-9]+)-month-([0-9]+)\.html$" "/calendar.php?calendar=$1&year=$2&month=$3"; |
| | rewrite "^/calendar-([0-9]+)-year-([0-9]+)-month-([0-9]+)-day-([0-9]+)\.html$" "/calendar.php?action=dayview&calendar=$1&year=$2&month=$3&day=$4"; |
| | rewrite "^/calendar-([0-9]+)-week-(n?[0-9]+)\.html$" "/calendar.php?action=weekview&calendar=$1&week=$2"; |
| | |
| | rewrite "^/event-([0-9]+)\.html$" "/calendar.php?action=event&eid=$1"; |
| | } |
| } | } |
| |
| <code> | <code> |
| @echo off | @echo off |
| | |
| | CD "%Temp%" |
| |
| SET "PHP_FCGI_MAX_REQUESTS=0" | SET "PHP_FCGI_MAX_REQUESTS=0" |
| |
| START "Forum PHP-CGI" /MIN "php-cgi.exe" -b "127.0.0.1:9006" -c "%SystemDrive%\www\php\forum.ini" -q | START "Forum PHP-CGI" /MIN "php-cgi.exe" -b "127.0.0.1:9006" -c "%SystemDrive%\www\php\forum.ini" -q |
| | |
| | SET "PHP_FCGI_MAX_REQUESTS=" |
| | SET "PHP_FCGI_CHILDREN=" |
| |
| :: End</code> | :: End</code> |
| |
| TITLE Forum Updater | TITLE Forum Updater |
| | CD "%Temp%" |
| |
| "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\forum" reset --hard "origin/feature" | "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\forum" reset --hard "origin/feature" |
| |
| ===== Back-up ===== | ===== Back-up ===== |
| |
| * :!: TODO | |
| |
| "notepad.exe" "%SystemDrive%\www\scripts\forum\Back-up.bat" | "notepad.exe" "%SystemDrive%\www\scripts\forum\Back-up.bat" |
| @echo off | @echo off |
| |
| :: User\Downloads | TITLE Forum Back-up |
| "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" | CD "%Temp%" |
| |
| :: NAS | "tar.exe" -czf "D:\Servers\Scheduled Backups\mybb-files-auto-%RANDOM%.tar.gz" -C "%SystemDrive%\www" "forum" |
| ::"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" | "%ProgramFiles%\MariaDB 12.2\bin\mariadb-dump.exe" -u "root" --opt -r "D:\Servers\Scheduled Backups\%RANDOM%-mybb.sql" "mybb" |
| | |
| | ::"tar.exe" -czf "%UserProfile%\Downloads\mybb-files-auto-%RANDOM%.tar.gz" -C "%SystemDrive%\www" "forum" |
| | ::"%ProgramFiles%\MariaDB 12.2\bin\mariadb-dump.exe" -u "root" --opt -r "%UserProfile%\Downloads\%RANDOM%-mybb.sql" "mybb" |
| |
| :: End</code> | :: End</code> |
| |
| TITLE Forum Maintenance | TITLE Forum Maintenance |
| | CD "%Temp%" |
| |
| CALL "%SystemDrive%\www\scripts\forum\Git Fix.bat" | "%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 |
| |
| :: End</code> | :: End</code> |
| ===== Git Fix ===== | ===== Git Fix ===== |
| |
| * :!: Set email for ''user.email'' | * :!: Set ''user.email'' |
| |
| "notepad.exe" "%SystemDrive%\www\scripts\forum\Git Fix.bat" | "notepad.exe" "%SystemDrive%\www\scripts\forum\Git Fix.bat" |
| |
| TITLE Forum Git Fix | TITLE Forum Git Fix |
| | CD "%Temp%" |
| |
| RMDIR /S /Q "%SystemDrive%\www\forum\.git" | ::################## |
| | ::# MyBB |
| | ::################## |
| |
| | RMDIR /S /Q "%SystemDrive%\www\forum\.git" |
| "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\forum" init --initial-branch="feature" | "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\forum" init --initial-branch="feature" |
| "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\forum" add "." | "%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" 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" 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" remote add "origin" "https://github.com/mybb/mybb.git" |
| "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\forum" pull --depth "1" --recurse-submodules "origin" "feature" --rebase | "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\forum" pull --depth "1" --recurse-submodules "origin" "feature" --rebase |
| "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\forum" reset --hard "origin/feature" | |
| |
| | "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\forum" reset --hard "origin/feature" |
| "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\forum" gc --aggressive --prune="all" | "%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 | "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\forum" fsck --full --strict |
| "%SystemDrive%\www\scripts\forum\Git Fix.bat" | "%SystemDrive%\www\scripts\forum\Git Fix.bat" |
| |
| ====== Shortcuts ====== | ====== Task Scheduler ====== |
| |
| ===== Autostart ===== | ===== PHP-CGI ===== |
| |
| ==== PHP-CGI ==== | * Auto-start |
| |
| "explorer.exe" "%AppData%\Microsoft\Windows\Start Menu\Programs\StartUp" | SCHTASKS /Create /SC "ONLOGON" /TN "Forum PHP-CGI" /TR "%SystemDrive%\www\scripts\forum\PHP-CGI.bat" /F |
| | |
| "%SystemDrive%\www\scripts\forum\PHP-CGI.bat" | |
| | |
| Forum PHP-CGI | |
| | |
| ====== Task Scheduler ====== | |
| | |
| **** | |
| | |
| taskschd.msc | |
| |
| ===== Update ===== | ===== Update ===== |
| |
| * ''5:00:00 AM'' daily | * Daily ''05:00:00 AM'' |
| |
| Forum Update | SCHTASKS /Create /SC "DAILY" /TN "Forum Update" /TR "%SystemDrive%\www\scripts\forum\Update.bat" /ST "05:00" /F |
| | |
| "%SystemDrive%\www\scripts\forum\Update.bat" | |
| |
| ===== Back-up ===== | ===== Back-up ===== |
| |
| * Monthly -> All months -> Days: ''6'' | * Monthly (6th) ''05:10:00 AM'' |
| * ''5:15:00 AM'' | |
| |
| Forum Back-up | SCHTASKS /Create /SC "MONTHLY" /D "6" /M "*" /TN "Forum Back-up" /TR "%SystemDrive%\www\scripts\forum\Back-up.bat" /ST "05:10" /F |
| | |
| "%SystemDrive%\www\scripts\forum\Back-up.bat" | |
| |
| ===== Maintenance ===== | ===== Maintenance ===== |
| |
| * Monthly -> All months -> Days: ''6'' | * Monthly (6th) ''05:30:00 AM'' |
| * ''5:30:00 AM'' | |
| |
| Forum Maintenance | SCHTASKS /Create /SC "MONTHLY" /D "6" /M "*" /TN "Forum Maintenance" /TR "%SystemDrive%\www\scripts\forum\Maintenance.bat" /ST "05:30" /F |
| | |
| "%SystemDrive%\www\scripts\forum\Maintenance.bat" | |
| |
| ====== Initial Setup ====== | ====== Initial Setup ====== |
| |
| ===== config.php ===== | ===== config.php ===== |
| |
| **** | |
| |
| "notepad.exe" "%SystemDrive%\www\forum\inc\config.php" | "notepad.exe" "%SystemDrive%\www\forum\inc\config.php" |
| |
| ====== Files ====== | $config['database']['hostname'] = 'localhost'; |
| |
| ===== Backup ===== | ====== Backup ====== |
| | |
| | ===== Folder ===== |
| |
| **** | **** |
| "tar.exe" -czf "%UserProfile%\Downloads\mybb-files-manual-%RANDOM%.tar.gz" -C "%SystemDrive%\www" "forum" | "tar.exe" -czf "%UserProfile%\Downloads\mybb-files-manual-%RANDOM%.tar.gz" -C "%SystemDrive%\www" "forum" |
| |
| ====== Database ====== | ===== Database ===== |
| |
| ===== Backup ===== | **** |
| |
| **** | CD "%UserProfile%\Downloads" && "%ProgramFiles%\MariaDB 12.2\bin\mariadb-dump.exe" -u "root" --opt -r "mybb.sql" "mybb" |
| |
| CD "%UserProfile%\Downloads" && "%ProgramFiles%\MariaDB 12.2\bin\mariadb-dump.exe" -u "root" -p --opt -r "mybb.sql" "mybb" | ====== Restore ====== |
| |
| ===== Restore ===== | ===== Database ===== |
| |
| * [[#database|Initial set-up]] | * [[#database|Initial set-up]] |
| |
| "%ProgramFiles%\MariaDB 12.2\bin\mariadb.exe" -u "root" -p --execute="CREATE DATABASE mybb" | "%ProgramFiles%\MariaDB 12.2\bin\mariadb.exe" -u "root" --execute="CREATE DATABASE mybb" |
| |
| "%ProgramFiles%\MariaDB 12.2\bin\mariadb.exe" -u "root" -p "mybb" < "%UserProfile%\Downloads\mybb.sql" | "%ProgramFiles%\MariaDB 12.2\bin\mariadb.exe" -u "root" "mybb" < "%UserProfile%\Downloads\mybb.sql" |
| |