====== Information ====== * DokuWiki ((https://www.dokuwiki.org/dokuwiki)) * [[information;realm_of_espionage|Realm of Espionage]] * https://wiki.realmofespionage.xyz ((you are here :p)) ===== Prerequisites ===== * [[windows;10_ltsc_server|Windows 10 (21H2)]] * [[servers;windows;nginx_php_php-cgi|nginx + PHP + PHP-CGI]] * [[servers;windows;nginx;lets_encrypt|Certbot (Let's Encrypt)]] * [[programs;windows;git|Git]] ====== Dependencies ====== * https://www.dokuwiki.org/requirements * https://www.dokuwiki.org/install:php * https://github.com/dokuwiki/dokuwiki/blob/master/composer.json ====== Download Source ====== * https://github.com/dokuwiki/dokuwiki/commits/master/ "%ProgramFiles%\Git\bin\git.exe" clone --branch "master" --depth "1" --recurse-submodules "https://github.com/splitbrain/dokuwiki.git" "%SystemDrive%\www\wiki" ====== nginx + PHP-CGI Configuration ====== ===== PHP ===== "notepad.exe" "%SystemDrive%\www\php\wiki.ini" [PHP] extension_dir = ".\ext" extension = "bz2" extension = "gd" extension = "intl" extension = "mbstring" extension = "openssl" extension = "sodium" 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\wiki.ini" -m ===== PHP-CGI ===== "notepad.exe" "%SystemDrive%\www\nginx\default.d\wiki.conf" location "~" "\.(php|phar)(/.*)?$" { fastcgi_split_path_info "^(.+\.(?:php|phar))(/.*)$"; fastcgi_intercept_errors "on"; fastcgi_index "doku.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:9002"; } # End ===== Server Block ===== "notepad.exe" "%SystemDrive%\www\nginx\vhosts.d\wiki.conf" server { listen "443" "ssl"; http2 "on"; server_name "wiki.realmofespionage.xyz"; root "C:/www/wiki"; index "doku.php"; include "C:/www/nginx/default.d/wiki.conf"; include "C:/www/nginx/default.d/headers.conf"; add_header "Content-Security-Policy" "default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data:" "always"; # access_log "logs/wiki-access.log"; # error_log "logs/wiki-error.log"; # location = "/install.php" { # deny "all"; # } # location "~" "/(conf|bin|inc)/" { # deny "all"; # } # location "~" "/data/" { # internal; # } location "/" { try_files "$uri" "$uri/" "@dokuwiki"; } location "@dokuwiki" { rewrite "^/_media/(.*)" "/lib/exe/fetch.php?media=$1" "last"; rewrite "^/_detail/(.*)" "/lib/exe/detail.php?media=$1" "last"; rewrite "^/_export/([^/]+)/(.*)" "/doku.php?do=export_$1&id=$2" "last"; rewrite "^/(.*)" "/doku.php?id=$1&$args" "last"; } } # End "%SystemDrive%\www\scripts\nginx\Reload.bat" ====== Scripts ====== MKDIR "%SystemDrive%\www\scripts\wiki" "explorer.exe" "%SystemDrive%\www\scripts\wiki" ===== PHP-CGI ===== "notepad.exe" "%SystemDrive%\www\scripts\wiki\PHP-CGI.bat" @echo off CD "%Temp%" SET "PHP_FCGI_MAX_REQUESTS=0" SET "PHP_FCGI_CHILDREN=1" START "Wiki PHP-CGI" /MIN "php-cgi.exe" -b "127.0.0.1:9002" -c "%SystemDrive%\www\php\wiki.ini" -q SET "PHP_FCGI_MAX_REQUESTS=" SET "PHP_FCGI_CHILDREN=" :: End "%SystemDrive%\www\scripts\wiki\PHP-CGI.bat" ===== Update ===== "notepad.exe" "%SystemDrive%\www\scripts\wiki\Update.bat" @echo off TITLE Wiki Updater CD "%Temp%" "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\wiki" reset --hard "origin/master" "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\wiki" pull origin "master" --rebase "php.exe" "%SystemDrive%\www\wiki\bin\indexer.php" --clear :: End "%SystemDrive%\www\scripts\wiki\Update.bat" ===== Back-up ===== "notepad.exe" "%SystemDrive%\www\scripts\wiki\Back-up.bat" @echo off TITLE Wiki Back-up CD "%Temp%" "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 "%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" :: End "%SystemDrive%\www\scripts\wiki\Back-up.bat" ===== Maintenance ===== "notepad.exe" "%SystemDrive%\www\scripts\wiki\Maintenance.bat" @echo off TITLE Wiki Maintenance CD "%Temp%" "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\wiki" gc --aggressive --prune="all" "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\wiki" fsck --full --strict :: End "%SystemDrive%\www\scripts\wiki\Maintenance.bat" ===== Git Fix ===== * :!: Set ''user.email'' "notepad.exe" "%SystemDrive%\www\scripts\wiki\Git Fix.bat" @echo off TITLE Wiki Git Fix CD "%Temp%" ::################## ::# DokuWiki ::################## RMDIR /S /Q "%SystemDrive%\www\wiki\.git" "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\wiki" init --initial-branch="master" "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\wiki" add "." ::###################################### "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\wiki" config "user.email" "espionage724@x" ::###################################### "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\wiki" commit --message="x" "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\wiki" remote add "origin" "https://github.com/dokuwiki/dokuwiki.git" "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\wiki" pull --depth "1" --recurse-submodules "origin" "master" --rebase "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\wiki" reset --hard "origin/master" "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\wiki" gc --aggressive --prune="all" "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\wiki" fsck --full --strict :: End "%SystemDrive%\www\scripts\wiki\Git Fix.bat" ====== Initial Setup ====== * https://wiki.realmofespionage.xyz/install.php ====== Settings ====== ===== Deny Directives ===== * Uncomment commented sections (except logs) * Do after initial setup and check warning in Admin panel "notepad.exe" "%SystemDrive%\www\nginx\vhosts.d\wiki.conf" "%SystemDrive%\www\scripts\nginx\Reload.bat" ===== Configuration Manager ===== * ''userewrite'': ''.htaccess'' * ''target»extern'': ''_tab'' ===== Template Style ===== * Alternative background color: ''#484848'' (dark gray) * The general link color: ''#3d8bff'' (blue) * Width of full site: ''85%'' * Width of sidebar: ''25%'' * :?: Color options may vary on the OS ((Windows doesn't show a HTML color code picker for the above ''#''s)) ===== Double-hyphen Convert Disable ===== * https://www.dokuwiki.org/entities * This prevents ''--'' from becoming a ''—'' (long hyphen/em dash) which breaks some command syntax ECHO -- -- > "%SystemDrive%\www\wiki\conf\entities.local.conf" ====== Task Scheduler ====== ===== PHP-CGI ===== * Auto-start SCHTASKS /Create /SC "ONLOGON" /TN "Wiki PHP-CGI" /TR "%SystemDrive%\www\scripts\wiki\PHP-CGI.bat" /F ===== Update ===== * Daily ''12:00:00 AM'' SCHTASKS /Create /SC "DAILY" /TN "Wiki Update" /TR "%SystemDrive%\www\scripts\wiki\Update.bat" /ST "00:00" /F ===== Back-up ===== * Weekly (Monday) ''12:10:00 AM'' SCHTASKS /Create /SC "WEEKLY" /D "MON" /TN "Wiki File Back-up" /TR "%SystemDrive%\www\scripts\wiki\Back-up.bat" /ST "00:10" /F ===== Maintenance ===== * Monthly (1st) ''12:30:00 AM'' SCHTASKS /Create /SC "MONTHLY" /D "1" /M "*" /TN "Wiki Maintenance" /TR "%SystemDrive%\www\scripts\wiki\Maintenance.bat" /ST "00:30" /F ====== Backup ====== ===== Folder ===== **** "tar.exe" -czf "%UserProfile%\Downloads\dokuwiki-files-manual-%RANDOM%.tar.gz" -C "%SystemDrive%\www\wiki" "data/pages" "data/meta" "data/media" "data/media_meta" "data/attic" "data/media_attic" "conf" ====== TODO ====== * https://www.dokuwiki.org/interwiki ===== Find Orphaned Pages ===== * https://www.dokuwiki.org/cli?s%5B%5D=wantedpages.php "php.exe" "%SystemDrive%\www\wiki\bin\wantedpages.php" "php.exe" "%SystemDrive%\www\wiki\bin\wantedpages.php" --help