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" -p
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 = "curl"
extension = "gd"
extension = "intl"
extension = "ldap"
extension = "mbstring"
extension = "mysqli"
extension = "openssl"
extension = "sodium"

error_reporting = "~E_ALL"
display_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 "/api/" {
  try_files "$uri" "$uri/" "/api/index.php?$args";
 }

 location "/" {
  try_files "$uri" "$uri/" "/index.php?$args";
 }

 location "~*" "/(images|cache|media|logs|tmp)/.*\.(php|pl|py|jsp|asp|sh|cgi)$" {
  return "403";
  error_page "403" "/403_error.html";
 }

 location "~*" "\.(ico|pdf|flv)$" {
  expires "1y";
 }

 location "~*" "\.(js|css|png|jpg|jpeg|gif|swf|xml|txt)$" {
  expires "14d";
 }
 
}

# 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

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

START "Forum PHP-CGI" "php-cgi.exe" -b "127.0.0.1:9006" -c "%SystemDrive%\www\php\forum.ini" -q

:: End
"%SystemDrive%\www\scripts\forum\PHP-CGI.bat"

Update

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

TITLE Forum Updater

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

  • :!: TODO
"notepad.exe" "%SystemDrive%\www\scripts\forum\Back-up.bat"
@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
"%SystemDrive%\www\scripts\forum\Back-up.bat"

Maintenance

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

TITLE Forum Maintenance

CALL "%SystemDrive%\www\scripts\forum\Git Fix.bat"

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

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"

Shortcuts

Autostart

PHP-CGI

"explorer.exe" "%AppData%\Microsoft\Windows\Start Menu\Programs\StartUp"
"%SystemDrive%\www\scripts\forum\PHP-CGI.bat"
Forum PHP-CGI

Task Scheduler

taskschd.msc

Update

  • 5:00:00 AM daily
Forum Update
"%SystemDrive%\www\scripts\forum\Update.bat"

Back-up

  • Weekly → Recur every 1 weeks on Monday
  • 12:15:00 AM
  • :!: TODO
Wiki File Back-up
"%SystemDrive%\www\scripts\media\Back-up.bat"

Maintenance

  • Monthly → All months → Days: 5
  • 5:30:00 AM
Forum Maintenance
"%SystemDrive%\www\scripts\forum\Maintenance.bat"

Initial Setup

  • Database Engine: MySQL Improved
  • Database Server Hostname: localhost
  • Database Username: mybb
  • Database Name: mybb' * Table Encoding: 4-Byte UTF-8 Unicode''

Settings

robots.txt

COPY /Y "%SystemDrive%\www\main\robots.txt.dist" "%SystemDrive%\www\main\robots.txt"

Setup

  • System → Setup → Global Configuration → Site → Site Offline: Enabled
  • System → Setup → Global Configuration → Site → Offline Message: Use Custom Message
This site is 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>

configuration.php

"notepad.exe" "%SystemDrive%\www\main\configuration.php"

Files

Backup

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

Database

Backup

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

Restore

"%ProgramFiles%\MariaDB 12.2\bin\mariadb.exe" -u "root" -p --execute="CREATE DATABASE mybb"
"%ProgramFiles%\MariaDB 12.2\bin\mariadb.exe" -u "root" -p "mybb" < "%UserProfile%\Downloads\mybb.sql"
/var/www/wiki/data/attic/servers/windows/nginx/mybb.1763683076.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