| Both sides previous revisionPrevious revisionNext revision | Previous revision |
| servers:windows:nginx:dokuwiki [2025/10/02 22:42] – [Maintenance] Sean Rhone | servers:windows:nginx:dokuwiki [2025/11/29 02:28] (current) – [Back-up] Sean Rhone |
|---|
| ===== 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)]] |
| <code> | <code> |
| [PHP] | [PHP] |
| ; Modules | |
| extension_dir = ".\ext" | extension_dir = ".\ext" |
| extension = "bz2" | extension = "bz2" |
| extension = "openssl" | extension = "openssl" |
| extension = "sodium" | extension = "sodium" |
| | |
| | error_reporting = "~E_ALL" |
| | display_errors = "Off" |
| | log_errors = "Off" |
| |
| [Date] | [Date] |
| ; End</code> | ; End</code> |
| |
| <code>"php.exe" -c "%SystemDrive%\www\php\wiki.ini" -m</code> | "php.exe" -c "%SystemDrive%\www\php\wiki.ini" -m |
| |
| ====== nginx + PHP-CGI Configuration ====== | ====== nginx + PHP-CGI Configuration ====== |
| |
| <code> | <code> |
| location ~ \.(php)(/.*)?$ { | location "~" "\.(php)(/.*)?$" { |
| fastcgi_split_path_info ^(.+\.(?:php))(/.*)$; | |
| fastcgi_intercept_errors "on"; | fastcgi_split_path_info "^(.+\.(?:php))(/.*)$"; |
| fastcgi_index "doku.php"; | fastcgi_intercept_errors "on"; |
| include "C:/www/nginx/conf/fastcgi_params"; | fastcgi_index "doku.php"; |
| fastcgi_param "SCRIPT_FILENAME" $document_root$fastcgi_script_name; | include "C:/www/nginx/conf/fastcgi_params"; |
| fastcgi_param "PATH_INFO" $fastcgi_path_info; | fastcgi_param "SCRIPT_FILENAME" "$document_root$fastcgi_script_name"; |
| fastcgi_param "HTTPS" "on"; | fastcgi_param "PATH_INFO" "$fastcgi_path_info"; |
| fastcgi_pass "127.0.0.1:9002"; | fastcgi_param "HTTPS" "on"; |
| | |
| | fastcgi_pass "127.0.0.1:9002"; |
| | |
| } | } |
| |
| <code> | <code> |
| server { | 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; | listen "443" "ssl"; |
| include C:/www/nginx/default.d/headers.conf; | http2 "on"; |
| | server_name "wiki.realmofespionage.xyz"; |
| | root "C:/www/wiki"; |
| | index "doku.php"; |
| |
| client_max_body_size "10M"; | 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; | client_max_body_size "10M"; |
| |
| # access_log logs/wiki-access.log; | add_header "Content-Security-Policy" "default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data:" "always"; |
| # error_log logs/wiki-error.log; | |
| |
| # location = /install.php { | # access_log "logs/wiki-access.log"; |
| # deny all; | # error_log "logs/wiki-error.log"; |
| # } | |
| |
| # location ~ /(conf|bin|inc)/ { | # location = "/install.php" { |
| # deny all; | # deny "all"; |
| # } | # } |
| |
| # location ~ /data/ { | # location "~" "/(conf|bin|inc)/" { |
| # internal; | # deny "all"; |
| # } | # } |
| |
| location / { try_files $uri $uri/ @dokuwiki; } | # 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"; |
| | } |
| |
| 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; | |
| } | |
| } | } |
| |
| SET "PHP_FCGI_CHILDREN=1" | SET "PHP_FCGI_CHILDREN=1" |
| |
| START "Wiki PHP-CGI" "php-cgi.exe" -b "127.0.0.1:9002" -c "%SystemDrive%\www\php\wiki.ini" -q | START "Wiki PHP-CGI" /MIN "php-cgi.exe" -b "127.0.0.1:9002" -c "%SystemDrive%\www\php\wiki.ini" -q |
| |
| :: End</code> | :: End</code> |
| @echo off | @echo off |
| |
| "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\wiki" pull origin "master" | TITLE Wiki Updater |
| | |
| | "%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</code> | :: End</code> |
| |
| ===== Back-up ===== | ===== Back-up ===== |
| | |
| | * ''D:\Servers\Scheduled Backups'' |
| |
| "notepad.exe" "%SystemDrive%\www\scripts\wiki\Back-up.bat" | "notepad.exe" "%SystemDrive%\www\scripts\wiki\Back-up.bat" |
| <code> | <code> |
| @echo off | @echo off |
| | |
| | TITLE Wiki 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\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 | :: 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\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</code> | :: End</code> |
| @echo off | @echo off |
| |
| "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\wiki" reset --hard | TITLE Wiki Maintenance |
| |
| "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\wiki" gc --aggressive --prune="all" | CALL "%SystemDrive%\www\scripts\wiki\Git Fix.bat" |
| "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\wiki" fsck --full --strict | |
| | |
| "php.exe" "%SystemDrive%\www\wiki\bin\indexer.php" --clear | |
| |
| :: End</code> | :: End</code> |
| <code> | <code> |
| @echo off | @echo off |
| | |
| | TITLE Wiki Git Fix |
| |
| RMDIR /S /Q "%SystemDrive%\www\wiki\.git" | RMDIR /S /Q "%SystemDrive%\www\wiki\.git" |
| "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\wiki" gc --aggressive --prune="all" | "%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 | "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\wiki" fsck --full --strict |
| |
| PAUSE | |
| |
| :: End</code> | :: End</code> |
| ===== Autostart ===== | ===== Autostart ===== |
| |
| ==== CGI ==== | ==== PHP-CGI ==== |
| |
| "explorer.exe" "%AppData%\Microsoft\Windows\Start Menu\Programs\StartUp" | "explorer.exe" "%AppData%\Microsoft\Windows\Start Menu\Programs\StartUp" |
| "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" | "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" |
| |
| ====== Quick Commands ====== | ====== TODOs ====== |
| | |
| | * https://www.dokuwiki.org/plugin:searchindex |
| | * https://www.dokuwiki.org/interwiki |
| |
| ===== Find Orphaned Pages ===== | ===== Find Orphaned Pages ===== |
| |
| "php.exe" "%SystemDrive%\www\wiki\bin\wantedpages.php" --help | "php.exe" "%SystemDrive%\www\wiki\bin\wantedpages.php" --help |
| |
| ===== Scripts ===== | |
| |
| **** | |
| |
| "explorer.exe" "%SystemDrive%\www\scripts\wiki" | |
| |
| ===== Bookmarks ===== | |
| |
| * https://github.com/dokuwiki/dokuwiki/commits/master/ | |
| |
| ====== TODOs ====== | |
| |
| * https://www.dokuwiki.org/plugin:searchindex | |
| * https://www.dokuwiki.org/interwiki | |
| |