| Both sides previous revisionPrevious revisionNext revision | Previous revision |
| servers:linux:nginx:dokuwiki [2026/04/29 21:54] – [Service] Sean Rhone | servers:linux:nginx:dokuwiki [2026/05/08 13:52] (current) – Sean Rhone |
|---|
| <code> | <code> |
| [wiki] | [wiki] |
| |
| ; User/Group | |
| user = "wwwrun" | user = "wwwrun" |
| group = "www" | group = "www" |
| |
| ; Socket | |
| listen = "/run/php-fpm/wiki.sock" | listen = "/run/php-fpm/wiki.sock" |
| listen.owner = "wwwrun" | listen.owner = "wwwrun" |
| listen.mode = "0662" | listen.mode = "0662" |
| |
| ; Process Management | |
| pm = "ondemand" | pm = "ondemand" |
| pm.max_children = "4" | pm.max_children = "4" |
| pm.process_idle_timeout = "30" | pm.process_idle_timeout = "30" |
| |
| ; Logging | |
| php_value[log_errors] = "0" | php_value[log_errors] = "0" |
| php_value[error_reporting] = "~E_ALL" | php_value[error_reporting] = "~E_ALL" |
| | php_value[display_errors] = "0" |
| | php_value[display_startup_errors] = "0" |
| | php_value[html_errors] = "0" |
| |
| ; openSUSE php.ini Defaults | |
| php_value[session.save_path] = "/var/lib/php8/sessions" | php_value[session.save_path] = "/var/lib/php8/sessions" |
| |
| ; General | |
| php_value[date.timezone] = "America/New_York" | php_value[date.timezone] = "America/New_York" |
| |
| |
| <code> | <code> |
| location '~' '\.(php|phar)(/.*)?$' { | location '~' '\.(php|phar)(/.*)?$' { |
| | fastcgi_split_path_info '^(.+\.(?:php|phar))(/.*)$'; |
| fastcgi_split_path_info '^(.+\.(?:php|phar))(/.*)$'; | fastcgi_intercept_errors 'on'; |
| fastcgi_intercept_errors 'on'; | fastcgi_index 'doku.php'; |
| fastcgi_index 'doku.php'; | include 'fastcgi_params'; |
| include 'fastcgi_params'; | fastcgi_param 'SCRIPT_FILENAME' '$document_root$fastcgi_script_name'; |
| fastcgi_param 'SCRIPT_FILENAME' '$document_root$fastcgi_script_name'; | fastcgi_param 'PATH_INFO' '$fastcgi_path_info'; |
| fastcgi_param 'PATH_INFO' '$fastcgi_path_info'; | fastcgi_param 'HTTPS' 'on'; |
| fastcgi_param 'HTTPS' 'on'; | fastcgi_pass 'unix:/run/php-fpm/wiki.sock'; |
| | } |
| fastcgi_pass 'unix:/run/php-fpm/wiki.sock'; | |
| | |
| } | |
| |
| # End</code> | # End</code> |
| <code> | <code> |
| server { | server { |
| |
| listen '443' 'ssl'; | listen '443' 'ssl'; |
| http2 'on'; | http2 'on'; |
| rewrite '^/(.*)' '/doku.php?id=$1&$args' 'last'; | rewrite '^/(.*)' '/doku.php?id=$1&$args' 'last'; |
| } | } |
| |
| } | } |
| |
| |
| echo '-- --' | sudo tee '/srv/www/wiki/conf/entities.local.conf' > '/dev/null' && sudo chown 'wwwrun':'www' '/srv/www/wiki/conf/entities.local.conf' | echo '-- --' | sudo tee '/srv/www/wiki/conf/entities.local.conf' > '/dev/null' && sudo chown 'wwwrun':'www' '/srv/www/wiki/conf/entities.local.conf' |
| |
| ====== Scripts ====== | |
| |
| ===== Git Fix ===== | |
| |
| * :!: Set email for ''user.email'' | |
| |
| sudo mkdir -p '/etc/nginx/scripts/wiki' && sudo -e '/etc/nginx/scripts/wiki/git-fix.sh' && sudo chmod '0500' '/etc/nginx/scripts/wiki/git-fix.sh' && sudo chown 'wwwrun':'www' '/etc/nginx/scripts/wiki/git-fix.sh' | |
| |
| <code> | |
| #!/bin/bash | |
| |
| cd '/tmp' | |
| |
| '/usr/bin/rm' -Rf '/srv/www/wiki/.git' | |
| '/usr/bin/git' -C '/srv/www/wiki' init --initial-branch='master' | |
| '/usr/bin/git' -C '/srv/www/wiki' add '.' | |
| |
| ######################################## | |
| '/usr/bin/git' -C '/srv/www/wiki' config 'user.email' 'espionage724@x' | |
| ######################################## | |
| |
| '/usr/bin/git' -C '/srv/www/wiki' commit --message='x' | |
| |
| '/usr/bin/git' -C '/srv/www/wiki' remote add 'origin' 'https://github.com/dokuwiki/dokuwiki.git' | |
| '/usr/bin/git' -C '/srv/www/wiki' pull --depth '1' --recurse-submodules 'origin' 'master' --rebase | |
| |
| '/usr/bin/git' -C '/srv/www/wiki' reset --hard 'origin/master' | |
| '/usr/bin/git' -C '/srv/www/wiki' gc --aggressive --prune='all' | |
| '/usr/bin/git' -C '/srv/www/wiki' fsck --full --strict | |
| |
| # End</code> | |
| |
| ==== Execute ==== | |
| |
| sudo su 'wwwrun' -s '/bin/bash' | |
| |
| '/etc/nginx/scripts/wiki/git-fix.sh' | |
| |
| exit | |
| |
| ====== Services ====== | ====== Services ====== |
| Type=oneshot | Type=oneshot |
| |
| WorkingDirectory=/srv/www/wiki | WorkingDirectory=/tmp |
| |
| ExecStart='/usr/bin/git' -C '/srv/www/wiki' reset --hard 'origin/master' | ExecStart='/usr/bin/git' -C '/srv/www/wiki' reset --hard 'origin/master' |
| |
| ExecStart='/usr/bin/php' '/srv/www/wiki/bin/indexer.php' --clear | ExecStart='/usr/bin/php' '/srv/www/wiki/bin/indexer.php' --clear |
| ExecStart='/usr/bin/touch' '/srv/www/wiki/conf/local.php' | |
| |
| ExecStartPost='/usr/bin/sync' | ExecStartPost='/usr/bin/touch' '/srv/www/wiki/conf/local.php' |
| |
| # End</code> | # End</code> |
| ==== Service ==== | ==== Service ==== |
| |
| * TODO: [[linux:notes:ext4]] | * [[linux:notes:ext4|ext4 NAS]] |
| |
| mkdir -p ~/'backups' && sudo -e '/etc/systemd/system/wiki-fb.service' && sudo sed -i 's/CHANGEME/'$USER'/g' '/etc/systemd/system/wiki-fb.service' | mkdir -p ~/'backups' && sudo -e '/etc/systemd/system/wiki-fb.service' && sudo sed -i 's/CHANGEME/'$USER'/g' '/etc/systemd/system/wiki-fb.service' |
| Type=oneshot | Type=oneshot |
| |
| WorkingDirectory=/srv/www/wiki | WorkingDirectory=/tmp |
| |
| ExecStart='/usr/bin/bash' -c '"/usr/bin/tar" -czf "/home/CHANGEME/backups/dokuwiki-files-auto-"$$(date +%%Y-%%m-%%d)".tar.gz" -C "/srv/www/wiki" "data/pages" "data/meta" "data/media" "data/media_meta" "data/attic" "data/media_attic" "conf"' | ExecStart='/usr/bin/bash' -c '"/usr/bin/tar" -czf "/mnt/NAS1/Servers/Scheduled Backups/dokuwiki-files-auto-"$$(date +%%Y-%%m-%%d)".tar.gz" -C "/srv/www/wiki" "data/pages" "data/meta" "data/media" "data/media_meta" "data/attic" "data/media_attic" "conf"' |
| |
| ExecStartPost='/usr/bin/sync' | #ExecStart='/usr/bin/bash' -c '"/usr/bin/tar" -czf "/home/CHANGEME/backups/dokuwiki-files-auto-"$$(date +%%Y-%%m-%%d)".tar.gz" -C "/srv/www/wiki" "data/pages" "data/meta" "data/media" "data/media_meta" "data/attic" "data/media_attic" "conf"' |
| |
| # End</code> | # End</code> |
| Type=oneshot | Type=oneshot |
| |
| WorkingDirectory=/srv/www/wiki | WorkingDirectory=/tmp |
| |
| ExecStart='/usr/bin/git' -C '/srv/www/wiki' gc --aggressive --prune='all' | ExecStart='/usr/bin/git' -C '/srv/www/wiki' gc --aggressive --prune='all' |
| ExecStart='/usr/bin/git' -C '/srv/www/wiki' fsck --full --strict | ExecStart='/usr/bin/git' -C '/srv/www/wiki' fsck --full --strict |
| |
| ExecStartPost='/usr/bin/sync' | |
| |
| # End</code> | # End</code> |
| sudo su 'wwwrun' -s '/bin/bash' | sudo su 'wwwrun' -s '/bin/bash' |
| |
| rm -Rf '/srv/www/wiki/.git' | cd '/tmp' && rm -Rf '/srv/www/wiki/.git' |
| |
| git -C '/srv/www/wiki' init --initial-branch='master' | git -C '/srv/www/wiki' init --initial-branch='master' |
| sudo su 'wwwrun' -s '/bin/bash' | sudo su 'wwwrun' -s '/bin/bash' |
| |
| cd '/srv/www/wiki' && '/usr/bin/php' '/srv/www/wiki/bin/indexer.php' --clear | cd '/tmp' && '/usr/bin/php' '/srv/www/wiki/bin/indexer.php' --clear |
| |
| exit | exit |
| ====== TODOs ====== | ====== TODOs ====== |
| |
| * https://www.dokuwiki.org/cli?s%5B%5D=wantedpages.php | ===== Find Orphaned Pages ===== |
| * https://www.dokuwiki.org/rewrite | |
| | * https://www.dokuwiki.org/cli#wantedpagesphp |
| | |
| | sudo su 'wwwrun' -s '/bin/bash' |
| | |
| | cd '/tmp' && '/usr/bin/php' '/srv/www/wiki/bin/wantedpages.php' |
| | |
| | cd '/tmp' && '/usr/bin/php' '/srv/www/wiki/bin/wantedpages.php' --help |
| | |
| | exit |
| |