User Tools

Site Tools


servers:windows:nginx:mybb

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
servers:windows:nginx:mybb [2025/10/10 07:41] – [Information] Sean Rhoneservers:windows:nginx:mybb [2025/11/29 00:44] (current) – [Back-up] Sean Rhone
Line 7: Line 7:
 ===== Prerequisites ===== ===== Prerequisites =====
  
-  * [[windows;11_ltsc_server|Windows 11 (24H2)]]+  * [[windows;10|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)]]
Line 20: Line 20:
 ====== Download Source ====== ====== Download Source ======
  
-  * https://github.com/mybb/mybb/commits/dev-1.9/+  * https://github.com/mybb/mybb/commits/feature/
  
-  "%ProgramFiles%\Git\bin\git.exe" clone --branch "dev-1.9" --depth "1" --recurse-submodules "https://github.com/mybb/mybb.git" "%SystemDrive%\www\forum"+  "%ProgramFiles%\Git\bin\git.exe" clone --branch "feature" --depth "1" --recurse-submodules "https://github.com/mybb/mybb.git" "%SystemDrive%\www\forum"
  
 ====== Database ====== ====== Database ======
  
-  "%ProgramFiles%\MariaDB 12.1\bin\mariadb.exe" -u "root" -p+  "%ProgramFiles%\MariaDB 12.2\bin\mariadb.exe" -u "root" -p
  
   CREATE DATABASE mybb;   CREATE DATABASE mybb;
Line 34: Line 34:
   GRANT ALL PRIVILEGES ON mybb.* to 'mybb'@'localhost';   GRANT ALL PRIVILEGES ON mybb.* to 'mybb'@'localhost';
  
-  FLUSH PRIVILEGES; +  FLUSH PRIVILEGES;EXIT;
- +
-  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] 
 +extension_dir = ".\ext" 
 +extension = "mysqli"
  
-  cd '/tmp' && composer --working-dir='/srv/www/forum' --no-cache install --no-dev+error_reporting "~E_ALL" 
 +display_errors = "Off" 
 +log_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;+====== nginx + PHP-CGI Configuration ======
  
-  CREATE USER 'mybb'@'localhost' IDENTIFIED BY 'x';+===== PHP-CGI =====
  
-  GRANT ALL PRIVILEGES ON mybb.* to 'mybb'@'localhost';+  "notepad.exe" "%SystemDrive%\www\nginx\default.d\forum.conf"
  
-  FLUSH PRIVILEGES;+<code> 
 +location "~" "\.(php)(/.*)?$" {
  
-  EXIT+ fastcgi_split_path_info "^(.+\.(?:php))(/.*)$"; 
 + fastcgi_intercept_errors "on"; 
 + fastcgi_index "index.php"; 
 + include "C:/www/nginx/conf/fastcgi_params"; 
 + fastcgi_param "SCRIPT_FILENAME" "$document_root$fastcgi_script_name"; 
 + fastcgi_param "PATH_INFO" "$fastcgi_path_info"; 
 + fastcgi_param "HTTPS" "on";
  
-====== nginx + PHP-FPM Configuration ======+ fastcgi_pass "127.0.0.1:9006";
  
-===== PHP-FPM Socket =====+}
  
-  sudo -e '/etc/php8/fpm/php-fpm.d/forum.conf' && sudo systemctl restart 'php-fpm'+# End</code> 
 + 
 +===== Server Block ===== 
 + 
 +  "notepad.exe" "%SystemDrive%\www\nginx\vhosts.d\forum.conf"
  
 <code> <code>
-[forum]+server {
  
-User/Group + listen "443" "ssl"
-user = "wwwrun+ http2 "on"; 
-group = "www"+ server_name "forums.realmofespionage.xyz"; 
 + root "C:/www/forum"
 + index "index.php";
  
-; Socket + include "C:/www/nginx/default.d/forum.conf"; 
-listen = "/run/php-fpm/forum.sock+ include "C:/www/nginx/default.d/headers.conf";
-listen.owner = "wwwrun" +
-listen.group = "www+
-listen.mode = "0662"+
  
-Process Management +# access_log "logs/forum-access.log"
-pm = "ondemand" +# error_log "logs/forum-error.log"; 
-pm.max_children = "4+  
-pm.process_idle_timeout = "30"+}
  
-; openSUSE php.ini Defaults +# End</code>
-php_value[session.save_path] = "/var/lib/php8/sessions"+
  
-; General +  "%SystemDrive%\www\scripts\nginx\Reload.bat"
-php_value[log_errors] = "0" +
-php_value[error_reporting] = "~E_ALL" +
-php_value[date.timezone] = "America/New_York" +
-php_value[max_execution_time] = "200" +
-php_value[memory_limit] = "512M" +
-php_value[post_max_size] = "10M" +
-php_value[upload_max_filesize] = "10M" +
-php_value[max_file_uploads] = "100"+
  
-; End</code>+====== Scripts ======
  
-===== FastCGI =====+===== Folder =====
  
-  * ''forum.sock''+  MKDIR "%SystemDrive%\www\scripts\forum"
  
-  sudo -e '/etc/nginx/default.d/forum.conf'+  "explorer.exe" "%SystemDrive%\www\scripts\forum" 
 + 
 +===== PHP-CGI ===== 
 + 
 +  "notepad.exe" "%SystemDrive%\www\scripts\forum\PHP-CGI.bat"
  
 <code> <code>
-location ~ \.(php|phar)(/.*)?$ { +@echo off
-    fastcgi_split_path_info ^(.+\.(?:php|phar))(/.*)$; +
-    fastcgi_intercept_errors on; +
-    fastcgi_index index.php; +
-    include fastcgi_params; +
-    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; +
-    fastcgi_param PATH_INFO $fastcgi_path_info; +
-    fastcgi_pass unix:/run/php-fpm/forum.sock; +
-}+
  
-# End</code>+SET "PHP_FCGI_MAX_REQUESTS=0" 
 +SET "PHP_FCGI_CHILDREN=1"
  
-===== Server Block =====+START "Forum PHP-CGI" /MIN "php-cgi.exe" -b "127.0.0.1:9006" -c "%SystemDrive%\www\php\forum.ini" -q
  
-  sudo -e '/etc/nginx/vhosts.d/forum.conf' && sudo systemctl reload 'nginx'+:: End</code>
  
-<code> +  "%SystemDrive%\www\scripts\forum\PHP-CGI.bat"
-server { +
-    listen '443' 'ssl'; +
-    http2 'on'; +
-    server_name 'forums.realmofespionage.xyz'; +
-    root '/srv/www/forum'; +
-    index 'index.php';+
  
-    include '/etc/nginx/default.d/forum.conf'; +===== Update =====
-    include '/etc/nginx/default.d/headers.conf';+
  
-    client_max_body_size '10M';+  "notepad.exe" "%SystemDrive%\www\scripts\forum\Update.bat"
  
-#    access_log  /var/log/nginx/forum-access.log; +<code> 
-#    error_log  /var/log/nginx/forum-error.log;+@echo off
  
-}+TITLE Forum Updater
  
-# End</code>+"%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\forum" reset --hard "origin/feature" 
 +"%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\forum" pull origin "feature" --rebase
  
-====== Scripts ======+:: End</code> 
 + 
 +  "%SystemDrive%\www\scripts\forum\Update.bat"
  
 ===== Back-up ===== ===== Back-up =====
  
-  * TODO+  * ''D:\Servers\Scheduled Backups''
  
-  "notepad.exe" "%SystemDrive%\www\scripts\media\Back-up.bat"+  "notepad.exe" "%SystemDrive%\www\scripts\forum\Back-up.bat"
  
 <code> <code>
 @echo off @echo off
 +
 +TITLE Forum Back-up
  
 :: User\Downloads :: 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"+::"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"
  
 :: NAS :: 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"+"tar.exe" -czf "D:\Servers\Scheduled Backups\mybb-files-auto-%RANDOM%.tar.gz" -C "%SystemDrive%\www" "forum" 
 +"%ProgramFiles%\MariaDB 12.2\bin\mariadb-dump.exe-u "root--opt -r "D:\Servers\Scheduled Backups\%RANDOM%-mybb.sql" "mybb"
  
 :: End</code> :: End</code>
  
-  "%SystemDrive%\www\scripts\media\Back-up.bat"+  "%SystemDrive%\www\scripts\forum\Back-up.bat"
  
 ===== Maintenance ===== ===== Maintenance =====
  
-  "notepad.exe" "%SystemDrive%\www\scripts\media\Maintenance.bat"+  "notepad.exe" "%SystemDrive%\www\scripts\forum\Maintenance.bat"
  
 <code> <code>
 @echo off @echo off
  
-:: Piwigo +TITLE Forum Maintenance
-"%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\media" reset --hard+
  
-"%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\media" gc --aggressive --prune="all" +CALL "%SystemDrive%\www\scripts\forum\Git Fix.bat"
-"%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_darkroomfsck --full --strict+
  
 :: End</code> :: End</code>
  
-  "%SystemDrive%\www\scripts\media\Maintenance.bat"+  "%SystemDrive%\www\scripts\forum\Maintenance.bat"
  
 ===== Git Fix ===== ===== Git Fix =====
Line 198: Line 192:
 <code> <code>
 @echo off @echo off
 +
 +TITLE Forum Git Fix
  
 RMDIR /S /Q "%SystemDrive%\www\forum\.git" 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" 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"
Line 207: Line 203:
  
 "%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" "dev-1.9" --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/dev-1.9"+"%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
- 
-PAUSE 
  
 :: End</code> :: End</code>
Line 219: Line 213:
   "%SystemDrive%\www\scripts\forum\Git Fix.bat"   "%SystemDrive%\www\scripts\forum\Git Fix.bat"
  
-====== Initial Setup ======+====== Shortcuts ======
  
-  * https://forums.realmofespionage.xyz+===== Autostart =====
  
-====== Settings ======+==== PHP-CGI ====
  
-  * TODO+  "explorer.exe" "%AppData%\Microsoft\Windows\Start Menu\Programs\StartUp"
  
-===== Offline Message =====+  "%SystemDrive%\www\scripts\forum\PHP-CGI.bat"
  
-  * Configuration -> Settings -> Board Online / Offline+  Forum PHP-CGI
  
-<code> +====== Task Scheduler ======
-These forums are being built behind-the-scenes, check back later! +
-<br /> +
-In the meantime, check out my wiki: <a href="https://wiki.realmofespionage.xyz/">RoE | Wiki</a> +
-</code>+
  
-===== config.php =====+****
  
-  * https://docs.mybb.com/1.8/administration/utf-8-setup/+  taskschd.msc
  
-  sudo su 'wwwrun' -s '/bin/bash'+===== Update =====
  
-  nano '/srv/www/forum/inc/config.php'+  ''5:00:00 AM'' daily
  
-<code> +  Forum Update
-$config['database']['encoding'] = 'utf8mb4';</code>+
  
-  exit+  "%SystemDrive%\www\scripts\forum\Update.bat"
  
-====== Services ======+===== Back-up =====
  
-===== Updater =====+  * Monthly -> All months -> Days: ''6'' 
 +  * ''5:15:00 AM''
  
-==== Service ====+  Forum Back-up
  
-  sudo -e '/etc/systemd/system/forum-up.service'+  "%SystemDrive%\www\scripts\forum\Back-up.bat"
  
-<code> +===== Maintenance =====
-[Service] +
-User=wwwrun +
-Group=www +
-Type=oneshot+
  
-Environment="COMPOSER_CACHE_DIR=/dev/null"+  * Monthly -> All months -> Days: ''6'' 
 +  * ''5:30:00 AM''
  
-ExecStart='/usr/bin/git' -C '/srv/www/forum' pull origin 'dev-1.9'+  Forum Maintenance
  
-ExecStart='/usr/bin/composer' --working-dir='/srv/www/forum' --no-cache install+  "%SystemDrive%\www\scripts\forum\Maintenance.bat"
  
-ExecStartPost='/usr/bin/sync'+====== Initial Setup ======
  
-# End</code>+  * Database Engine: ''MySQL Improved'' 
 +  * Database Server Hostname: ''localhost'' 
 +  * Table Encoding: ''4-Byte UTF-8 Unicode''
  
-==== Timer ====+  * https://forums.realmofespionage.xyz
  
-  * Every day at ''05:00:00''+====== Configuration ======
  
-  sudo -e '/etc/systemd/system/forum-up.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'forum-up.timer' --now && sudo systemctl start 'forum-up' && sudo systemctl status 'forum-up' -l+===== Board Online Offline =====
  
-<code> +  Board Closed''[x]'' Yes
-[Unit] +
-Description=MyBB Git Updater +
-After=network-online.target +
-Wants=network-online.target +
- +
-[Timer] +
-OnCalendar=*-*-* 05:00:00 +
-Persistent=true +
- +
-[Install] +
-WantedBy=timers.target +
- +
-# End</code> +
- +
-===== Backup ===== +
- +
-==== Files ==== +
- +
-=== Service === +
- +
-  mkdir -p ~/'backups' && sudo -e '/etc/systemd/system/forum-fb.service' && sudo sed -i 's/CHANGEME/'$USER'/g' '/etc/systemd/system/forum-fb.service'+
  
 <code> <code>
-[Service] +These forums are being built behind-the-scenes, check back later! 
-Type=oneshot+<br /> 
 +In the meantime, check out my wiki: <a href="https://wiki.realmofespionage.xyz/">RoE | Wiki</a></code>
  
-ExecStart='/usr/bin/bash' -c '"/usr/bin/tar" -czf "/home/CHANGEME/backups/mybb-files-auto-"$$(date +%%Y-%%m-%%d)".tar.gz" -C "/srv/www" "forum"'+===== Login and Registration =====
  
-ExecStartPost='/usr/bin/sync'+  * Disable Registrations: ''[x]'' Yes
  
-# End</code>+===== config.php =====
  
-=== Timer === +****
- +
-  ''01'' day of every month at ''05:15:00'' +
- +
-  sudo -e '/etc/systemd/system/forum-fb.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'forum-fb.timer' --now +
- +
-<code> +
-[Unit] +
-Description=MyBB Files Backup +
- +
-[Timer] +
-OnCalendar=*-*-01 05:15:00 +
-Persistent=true +
- +
-[Install] +
-WantedBy=timers.target +
- +
-# End</code> +
- +
-  sudo systemctl start 'forum-fb' && sudo systemctl status 'forum-fb' -l +
- +
-==== Database ==== +
- +
-=== Database Auth === +
- +
-  sudo mkdir -p '/var/lib/mysql/auth' && sudo -e '/var/lib/mysql/auth/mybb' && sudo chown 'mysql':'mysql' '/var/lib/mysql/auth/mybb' && sudo chmod '0600' '/var/lib/mysql/auth/mybb' +
- +
-<code> +
-[mariadb-dump] +
-user=mybb +
-password=x +
- +
-# End</code> +
- +
-=== Service === +
- +
-  mkdir -p ~/'backups' && sudo mkdir -p '/var/lib/mysql/tmp' && sudo -e '/etc/systemd/system/forum-db.service' && sudo sed -i 's/'CHANGEME'/'$USER'/g' '/etc/systemd/system/forum-db.service' +
- +
-<code> +
-[Service] +
-Group=mysql +
-Type=oneshot +
- +
-ExecStart='/usr/bin/bash' -c '"/usr/bin/mariadb-dump" --defaults-extra-file="/var/lib/mysql/auth/mybb" --single-transaction --quick "mybb" -r "/home/CHANGEME/backups/mybb-database-auto-"$$(date +%%Y-%%m-%%d)".sql"' +
- +
-ExecStartPost='/usr/bin/sync' +
- +
-# End</code> +
- +
-=== Timer === +
- +
-  ''01'' day of every month at ''05:10:00'' +
- +
-  sudo -e '/etc/systemd/system/forum-db.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'forum-db.timer' --now && sudo systemctl start 'forum-db' && sudo systemctl status 'forum-db' -l +
- +
-<code> +
-[Unit] +
-Description=mybb Database Backup +
-After=mariadb.service +
- +
-[Timer] +
-OnCalendar=*-*-01 05:10:00 +
-Persistent=true +
- +
-[Install] +
-WantedBy=timers.target +
- +
-# End</code> +
- +
-===== Maintenance ===== +
- +
-==== Service ==== +
- +
-  sudo -e '/etc/systemd/system/forum-m.service' +
- +
-<code> +
-[Service] +
-User=wwwrun +
-Group=www +
-Type=oneshot +
- +
-ExecStart='/usr/bin/git' -C '/srv/www/forum' reset --hard +
-ExecStart='/usr/bin/git' -C '/srv/www/forum' gc --aggressive --prune='all' +
-ExecStart='/usr/bin/git' -C '/srv/www/forum' fsck --full --strict +
- +
-ExecStartPost='/usr/bin/sync' +
- +
-# End</code> +
- +
-==== Timer ==== +
- +
-  * ''01'' day of every month at ''05:30:00'' +
- +
-  sudo -e '/etc/systemd/system/forum-m.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'forum-m.timer' --now +
- +
-<code> +
-[Unit] +
-Description=MyBB Maintenance +
-After=network-online.target +
-Wants=network-online.target +
- +
-[Timer] +
-OnCalendar=*-*-01 05:30:00 +
-Persistent=true +
- +
-[Install] +
-WantedBy=timers.target +
- +
-# End</code>+
  
-  sudo systemctl start 'forum-m' && sudo systemctl status 'forum-m' -l+  "notepad.exe" "%SystemDrive%\www\forum\inc\config.php"
  
 ====== Files ====== ====== Files ======
Line 439: Line 300:
 **** ****
  
-  CD "%UserProfile%\Downloads" && "%ProgramFiles%\MariaDB 12.1\bin\mariadb-dump.exe" -u "root" -p --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 =====
Line 445: Line 306:
   * [[#database|Initial set-up]]   * [[#database|Initial set-up]]
  
-  "%ProgramFiles%\MariaDB 12.1\bin\mariadb.exe" -u "root" -p --execute="CREATE DATABASE mybb"+  "%ProgramFiles%\MariaDB 12.2\bin\mariadb.exe" -u "root" -p --execute="CREATE DATABASE mybb"
  
-  "%ProgramFiles%\MariaDB 12.1\bin\mariadb.exe" -u "root" -p "mybb" < "%UserProfile%\Downloads\mybb.sql"+  "%ProgramFiles%\MariaDB 12.2\bin\mariadb.exe" -u "root" -p "mybb" < "%UserProfile%\Downloads\mybb.sql"
  
/var/www/wiki/data/attic/servers/windows/nginx/mybb.1760096509.txt.gz · Last modified: by Sean Rhone

Except where otherwise noted, content on this wiki is licensed under the following license: CC0 1.0 Universal
CC0 1.0 Universal Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki