User Tools

Site Tools


servers:windows:nginx:mybb

This is an old revision of the document!


Information

Prerequisites

Dependencies

Download Source

"%ProgramFiles%\Git\bin\git.exe" clone --branch "feature" --depth "1" --recurse-submodules "https://github.com/mybb/mybb.git" "%SystemDrive%\www\forum"

Database

"%ProgramFiles%\MariaDB 12.2\bin\mariadb.exe" -u "root"
CREATE DATABASE mybb;
CREATE USER 'mybb'@'localhost' IDENTIFIED BY 'x';
GRANT ALL PRIVILEGES ON mybb.* to 'mybb'@'localhost';
FLUSH PRIVILEGES;EXIT;

Environment

PHP

"notepad.exe" "%SystemDrive%\www\php\forum.ini"
[PHP]
extension_dir = ".\ext"
extension = "mysqli"

log_errors = "Off"
error_reporting = "~E_ALL"
display_errors = "Off"
display_startup_errors = "Off"
html_errors = "Off"

[Date]
date.timezone = "America/New_York"

; End
"php.exe" -c "%SystemDrive%\www\php\forum.ini" -m

nginx + PHP-CGI Configuration

PHP-CGI

"notepad.exe" "%SystemDrive%\www\nginx\default.d\forum.conf"
location "~" "\.(php)(/.*)?$" {
 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";

 fastcgi_pass "127.0.0.1:9006";
}

# End

Server Block

"notepad.exe" "%SystemDrive%\www\nginx\vhosts.d\forum.conf"
server {
 listen "443" "ssl";
 http2 "on";
 server_name "forums.realmofespionage.xyz";
 root "C:/www/forum";
 index "index.php";

 include "C:/www/nginx/default.d/forum.conf";
 include "C:/www/nginx/default.d/headers.conf";

# access_log "logs/forum-access.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";
 }
}

# End
"%SystemDrive%\www\scripts\nginx\Reload.bat"

Scripts

Folder

MKDIR "%SystemDrive%\www\scripts\forum"
"explorer.exe" "%SystemDrive%\www\scripts\forum"

PHP-CGI

"notepad.exe" "%SystemDrive%\www\scripts\forum\PHP-CGI.bat"
@echo off

CD "%Temp%"

SET "PHP_FCGI_MAX_REQUESTS=0"
SET "PHP_FCGI_CHILDREN=1"

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
"%SystemDrive%\www\scripts\forum\PHP-CGI.bat"

Update

"notepad.exe" "%SystemDrive%\www\scripts\forum\Update.bat"
@echo off

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" pull origin "feature" --rebase

:: End
"%SystemDrive%\www\scripts\forum\Update.bat"

Back-up

"notepad.exe" "%SystemDrive%\www\scripts\forum\Back-up.bat"
@echo off

TITLE Forum Back-up
CD "%Temp%"

"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"

::"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
"%SystemDrive%\www\scripts\forum\Back-up.bat"

Maintenance

"notepad.exe" "%SystemDrive%\www\scripts\forum\Maintenance.bat"
@echo off

TITLE Forum Maintenance
CD "%Temp%"

"%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
"%SystemDrive%\www\scripts\forum\Maintenance.bat"

Git Fix

  • :!: Set email for user.email
"notepad.exe" "%SystemDrive%\www\scripts\forum\Git Fix.bat"
@echo off

TITLE Forum Git Fix
CD "%Temp%"

::##################
::# 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" 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" "feature" --rebase

"%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" fsck --full --strict

:: End
"%SystemDrive%\www\scripts\forum\Git Fix.bat"

Task Scheduler

PHP-CGI

  • Auto-start
SCHTASKS /Create /SC "ONLOGON" /TN "Forum PHP-CGI" /TR "%SystemDrive%\www\scripts\forum\PHP-CGI.bat" /F

Update

  • Daily 05:00:00 AM
SCHTASKS /Create /SC "DAILY" /TN "Forum Update" /TR "%SystemDrive%\www\scripts\forum\Update.bat" /ST "05:00" /F

Back-up

  • Monthly (6th) 05:10:00 AM
SCHTASKS /Create /SC "MONTHLY" /D "6" /M "*" /TN "Forum Back-up" /TR "%SystemDrive%\www\scripts\forum\Back-up.bat" /ST "05:10" /F

Maintenance

  • Monthly (6th) 05:30:00 AM
SCHTASKS /Create /SC "MONTHLY" /D "6" /M "*" /TN "Forum Maintenance" /TR "%SystemDrive%\www\scripts\forum\Maintenance.bat" /ST "05:30" /F

Initial Setup

  • Database Engine: MySQL Improved
  • Database Server Hostname: localhost
  • Table Encoding: 4-Byte UTF-8 Unicode

Configuration

Board Online / Offline

  • Board Closed: [x] Yes
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>

Login and Registration

  • Disable Registrations: [x] Yes

config.php

"notepad.exe" "%SystemDrive%\www\forum\inc\config.php"

Backup

Folder

"tar.exe" -czf "%UserProfile%\Downloads\mybb-files-manual-%RANDOM%.tar.gz" -C "%SystemDrive%\www" "forum"

Database

CD "%UserProfile%\Downloads" && "%ProgramFiles%\MariaDB 12.2\bin\mariadb-dump.exe" -u "root" --opt -r "mybb.sql" "mybb"

Restore

Database

"%ProgramFiles%\MariaDB 12.2\bin\mariadb.exe" -u "root" --execute="CREATE DATABASE mybb"
"%ProgramFiles%\MariaDB 12.2\bin\mariadb.exe" -u "root" "mybb" < "%UserProfile%\Downloads\mybb.sql"
/usr/local/www/wiki/data/attic/servers/windows/nginx/mybb.1768926783.txt.gz · Last modified: by Sean Rhone