User Tools

Site Tools


servers:linux:nginx:dokuwiki

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
servers:linux:nginx:dokuwiki [2024/08/13 22:15] – created Sean Rhoneservers:linux:nginx:dokuwiki [2025/09/18 03:36] (current) – [Service] Sean Rhone
Line 1: Line 1:
 ====== Information ====== ====== Information ======
  
-  * DokuWiki ((https://www.dokuwiki.org)) ((https://github.com/splitbrain/dokuwiki)) +  * DokuWiki 
-  * [[Information:Realm of Espionage]]+  * [[information:realm_of_espionage|Realm of Espionage]]
   * https://wiki.realmofespionage.xyz ((you are here :p))   * https://wiki.realmofespionage.xyz ((you are here :p))
  
 ===== Prerequisites ===== ===== Prerequisites =====
  
-  * [[distros:fedora_server|Fedora Server]] +  * [[linux:distros:server:opensuse_tumbleweed_server|openSUSE Tumbleweed (Server)]] 
-  * [[servers:nginx_php_php-fpm|nginx + PHP + PHP-FPM]] +  * [[servers:linux:nginx_php_php-fpm|nginx + PHP + PHP-FPM]] 
-  * [[servers:nginx:lets_encrypt|Let's Encrypt]]+  * [[servers:linux:nginx:lets_encrypt|Certbot (Let's Encrypt)]]
  
-====== TODO ======+====== TODOs ======
  
   * https://www.dokuwiki.org/cli?s%5B%5D=wantedpages.php   * https://www.dokuwiki.org/cli?s%5B%5D=wantedpages.php
Line 17: Line 17:
 ====== Dependencies ====== ====== Dependencies ======
  
-  * PHP Modulesgd sodium zip zlib xml+  * https://www.dokuwiki.org/requirements 
 +  * https://www.dokuwiki.org/install:php 
 +  * https://github.com/dokuwiki/dokuwiki/blob/master/composer.json
  
-  sudo dnf install php-gd php-sodium php-pecl-zip php-xml+  sudo zypper install php8-bz2 php8-gd php8-intl php8-mbstring php8-sodium php8-zlib
  
 ====== Download Source ====== ====== Download Source ======
  
-****+  https://github.com/dokuwiki/dokuwiki/commits/master/
  
-  sudo git clone --branch 'master' --depth '1' --recurse-submodules 'https://github.com/splitbrain/dokuwiki.git' '/var/www/wiki' && sudo semanage fcontext --add --type 'httpd_sys_rw_content_t' '/var/www/wiki(/.*)?&& sudo restorecon -F -I -R '/var/www/wiki' && sudo chown -R 'nginx':'nginx' '/var/www/wiki' && sync+  sudo git clone --branch 'master' --depth '1' --recurse-submodules 'https://github.com/splitbrain/dokuwiki.git' '/srv/www/wiki' && sudo chown -'wwwrun':'www' '/srv/www/wiki' && sudo chmod -R '0755' '/srv/www/wiki'
  
 ====== nginx + PHP-FPM Configuration ====== ====== nginx + PHP-FPM Configuration ======
Line 31: Line 33:
 ===== PHP-FPM Socket ===== ===== PHP-FPM Socket =====
  
-  sudo -e '/etc/php-fpm.d/wiki.conf' && sudo systemctl restart 'php-fpm'+  sudo -e '/etc/php8/fpm/php-fpm.d/wiki.conf' && sudo systemctl restart 'php-fpm'
  
 <code> <code>
Line 37: Line 39:
  
 ; User/Group ; User/Group
-user = nginx +user = "wwwrun" 
-group = nginx+group = "www"
  
 ; Socket ; Socket
-listen = /run/php-fpm/wiki.sock +listen = "/run/php-fpm/wiki.sock" 
-listen.acl_users nginx +listen.owner "wwwrun" 
-listen.allowed_clients 127.0.0.1+listen.group "www" 
 +listen.mode = "0662"
  
 ; Process Management ; Process Management
-pm = ondemand +pm = "ondemand" 
-pm.max_children = 4 +pm.max_children = "4" 
-pm.process_idle_timeout = 30+pm.process_idle_timeout = "30"
  
-Fedora php.ini Defaults +openSUSE php.ini Defaults 
-php_value[session.save_handler] = "files" +php_value[session.save_path] = "/var/lib/php8/sessions"
-php_value[session.save_path] = "/var/lib/php/session"+
  
 ; General ; General
 +php_value[log_errors] = "0"
 +php_value[error_reporting] = "~E_ALL"
 php_value[date.timezone] = "America/New_York" php_value[date.timezone] = "America/New_York"
-;php_value[max_execution_time] = "200" 
-;php_value[memory_limit] = "512M" 
-;php_value[post_max_size] = "10M" 
-;php_value[upload_max_filesize] = "10M" 
-;php_value[max_file_uploads] = "100" 
  
 ; End</code> ; End</code>
  
 ===== FastCGI ===== ===== FastCGI =====
 +
 +  * ''wiki.sock''
  
   sudo -e '/etc/nginx/default.d/wiki.conf'   sudo -e '/etc/nginx/default.d/wiki.conf'
  
 <code> <code>
-# PHP-FPM 
 location ~ \.(php|phar)(/.*)?$ { location ~ \.(php|phar)(/.*)?$ {
     fastcgi_split_path_info ^(.+\.(?:php|phar))(/.*)$;     fastcgi_split_path_info ^(.+\.(?:php|phar))(/.*)$;
Line 79: Line 79:
     fastcgi_param HTTPS on;     fastcgi_param HTTPS on;
     fastcgi_pass unix:/run/php-fpm/wiki.sock;     fastcgi_pass unix:/run/php-fpm/wiki.sock;
-}</code>+} 
 + 
 +# End</code>
  
 ===== Server Block ====== ===== Server Block ======
  
-  sudo -e '/etc/nginx/vhosts.d/wiki.conf' && sudo systemctl reload 'nginx' && sync+  sudo -e '/etc/nginx/vhosts.d/wiki.conf' && sudo systemctl reload 'nginx'
  
 <code> <code>
Line 90: Line 92:
     http2 'on';     http2 'on';
     server_name 'wiki.realmofespionage.xyz';     server_name 'wiki.realmofespionage.xyz';
-    root '/var/www/wiki';+    root '/srv/www/wiki';
     index 'doku.php';     index 'doku.php';
  
Line 123: Line 125:
         rewrite ^/(.*) /doku.php?id=$1&$args last;         rewrite ^/(.*) /doku.php?id=$1&$args last;
     }     }
-}</code>+} 
 + 
 +# End</code>
  
 ====== Initial Setup ====== ====== Initial Setup ======
Line 160: Line 164:
   * This prevents -- from becoming a – (long hyphen), which breaks some command's syntax   * This prevents -- from becoming a – (long hyphen), which breaks some command's syntax
  
-  echo '--      --' | sudo tee '/var/www/wiki/conf/entities.local.conf' > '/dev/null' && sudo chown 'nginx':'nginx' '/var/www/wiki/conf/entities.local.conf' && sync+  echo '--      --' | sudo tee '/srv/www/wiki/conf/entities.local.conf' > '/dev/null' && sudo chown 'wwwrun':'www' '/srv/www/wiki/conf/entities.local.conf'
  
 ====== Services ====== ====== Services ======
Line 172: Line 176:
 <code> <code>
 [Service] [Service]
-User=nginx +User=wwwrun 
-Group=nginx+Group=www
 Type=oneshot Type=oneshot
-ExecStart='/usr/bin/git' -C '/var/www/wiki' pull origin 'master' + 
-ExecStartPost='/usr/bin/touch' '/var/www/wiki/conf/local.php'+ExecStart='/usr/bin/git' -C '/srv/www/wiki' pull origin 'master' 
 + 
 +ExecStartPost='/usr/bin/touch' '/srv/www/wiki/conf/local.php'
 ExecStartPost='/usr/bin/sync' ExecStartPost='/usr/bin/sync'
  
Line 183: Line 189:
 ==== Timer ==== ==== Timer ====
  
-  * Every day at ''00:30:00''+  * Every day at ''00:00:00''
  
   sudo -e '/etc/systemd/system/wiki-up.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'wiki-up.timer' --now && sudo systemctl start 'wiki-up' && sudo systemctl status 'wiki-up' -l   sudo -e '/etc/systemd/system/wiki-up.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'wiki-up.timer' --now && sudo systemctl start 'wiki-up' && sudo systemctl status 'wiki-up' -l
Line 194: Line 200:
  
 [Timer] [Timer]
-OnCalendar=*-*-* 00:30:00+OnCalendar=*-*-* 00:00:00
 Persistent=true Persistent=true
  
Line 202: Line 208:
 # End</code> # End</code>
  
-===== Maintenance ===== +===== Backup =====
- +
-  * https://www.dokuwiki.org/tips:maintenance+
  
 ==== Service ==== ==== Service ====
  
-  * :!: The commented ''ExecStart'' would remove page edits older than 90 days +  mkdir -p ~/'backups&& sudo -e '/etc/systemd/system/wiki-fb.service&& sudo sed -i 's/CHANGEME/'$USER'/g' '/etc/systemd/system/wiki-fb.service'
- +
-  sudo -'/etc/systemd/system/wiki-m.service'+
  
 <code> <code>
 [Service] [Service]
-User=nginx 
-Group=nginx 
 Type=oneshot Type=oneshot
-WorkingDirectory=/var/www/wiki + 
-ExecStart='/usr/bin/git' -C '/var/www/wiki' gc --aggressive --prune='all' +ExecStart='/usr/bin/bash' -'"/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/git' -C '/var/www/wiki' fsck --full --strict +
-#ExecStart='/usr/bin/bash' -"find '/var/www/wiki/data'/{attic,cache,locks,media_attic}-type 'f' -mtime +'90' -delete" +
-ExecStart='/usr/bin/bash' -c "find '/var/www/wiki/data'/{attic,cache,index,locks,media,media_attic,media_meta,meta,pages,tmp}/ -mindepth '1' -type 'd' -empty -delete" +
-ExecStart='/usr/bin/php' '/var/www/wiki/bin/indexer.php' --clear+
 ExecStartPost='/usr/bin/sync' ExecStartPost='/usr/bin/sync'
  
Line 229: Line 226:
 ==== Timer ==== ==== Timer ====
  
-  * ''01'' day of every month at ''01:00:00''+  * Every day at ''00:15:00''
  
-  sudo -e '/etc/systemd/system/wiki-m.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'wiki-m.timer' --now+  sudo -e '/etc/systemd/system/wiki-fb.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'wiki-fb.timer' --now && sudo systemctl start 'wiki-fb' && sudo systemctl status 'wiki-fb' -l
  
 <code> <code>
 [Unit] [Unit]
-Description=DokuWiki Maintenance+Description=DokuWiki Files Backup
  
 [Timer] [Timer]
-OnCalendar=*-*-01 01:00:00+OnCalendar=*-*-00:15:00
 Persistent=true Persistent=true
  
Line 246: Line 243:
 # End</code> # End</code>
  
-===== Backup ===== +===== Maintenance =====
- +
-  * This backs up an archive to the local disk and to a NAS+
  
 ==== Service ==== ==== Service ====
  
-  * The extra ''ExecStart''s are additional backup locations that expect [[servers:vsftpd|vsftpd]] +  sudo -e '/etc/systemd/system/wiki-m.service'
-  * TODO: Remove additional backup locations and put it on a system-wide script direct from the ''~/backups'' folder +
- +
-  mkdir -p ~/'backups' && sudo -e '/etc/systemd/system/wiki-fb.service' && sudo sed -i 's/CHANGEME/'$USER'/g' '/etc/systemd/system/wiki-fb.service'+
  
 <code> <code>
 [Service] [Service]
 +User=wwwrun
 +Group=www
 Type=oneshot Type=oneshot
-WorkingDirectory=/var/www/wiki + 
-ExecStart='/usr/bin/bash' -'"/usr/bin/tar" -czf "/home/CHANGEME/backups/dokuwiki-files-auto-"$$(date +%%Y-%%m-%%d)".tar.gz" "data/pages" "data/meta" "data/media" "data/media_meta" "data/attic" "data/media_attic" "conf"+WorkingDirectory=/tmp 
-#ExecStart='/usr/bin/bash' -'"/usr/bin/tar" -czf "/var/ftp/nas1/Servers/Scheduled Backups/dokuwiki-files-auto-"$$(date +%%Y-%%m-%%d)".tar.gz" "data/pages" "data/meta" "data/media" "data/media_meta" "data/attic" "data/media_attic" "conf"' + 
-#ExecStart='/usr/bin/bash' -c '"/usr/bin/tar" -czf "/srv/ftp/nas2/Servers/Scheduled Backups/dokuwiki-files-auto-"$$(date +%%Y-%%m-%%d)".tar.gz" "data/pages" "data/meta" "data/media" "data/media_meta" "data/attic" "data/media_attic" "conf"'+ExecStart='/usr/bin/git' -C '/srv/www/wiki' reset --hard 
 +ExecStart='/usr/bin/git' -C '/srv/www/wiki' gc --aggressive --prune='all
 +ExecStart='/usr/bin/git' -'/srv/www/wiki' fsck --full --strict 
 + 
 +ExecStart='/usr/bin/bash' -c "find '/srv/www/wiki/data'/{attic,cache,index,locks,media,media_attic,media_meta,meta,pages,tmp}/ -mindepth '1' -type 'd' -empty -delete" 
 +ExecStart='/usr/bin/php' '/srv/www/wiki/bin/indexer.php--clear 
 ExecStartPost='/usr/bin/sync' ExecStartPost='/usr/bin/sync'
  
Line 270: Line 270:
 ==== Timer ==== ==== Timer ====
  
-  * Every day at ''01:30:00''+  * ''01'' day of every month at ''00:30:00''
  
-  sudo -e '/etc/systemd/system/wiki-fb.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'wiki-fb.timer' --now && sudo systemctl start 'wiki-fb' && sudo systemctl status 'wiki-fb' -l+  sudo -e '/etc/systemd/system/wiki-m.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'wiki-m.timer' --now
  
 <code> <code>
 [Unit] [Unit]
-Description=DokuWiki Files Backup+Description=DokuWiki Maintenance
  
 [Timer] [Timer]
-OnCalendar=*-*-01:30:00+OnCalendar=*-*-01 00:30:00
 Persistent=true Persistent=true
  
Line 286: Line 286:
  
 # End</code> # End</code>
 +
 +  sudo systemctl start 'wiki-m' && sudo systemctl status 'wiki-m' -l
  
 ====== Backup ====== ====== Backup ======
  
-  * Create backup archive on server and transfer to client computer +===== Files =====
- +
-===== Server ===== +
- +
-==== Archive Folders ====+
  
 **** ****
  
-  cd '/var/www/wiki' && sudo tar -cvzf ~/'dokuwiki-files-manual-'$(date +%Y-%m-%d)'.tar.gz' 'data/pages' 'data/meta' 'data/media' 'data/media_meta' 'data/attic' 'data/media_attic' 'conf' && cd ~ && sync +  sudo tar -czf ~/'dokuwiki-files-manual-'$(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'
- +
-===== Client =====+
  
-==== Transfer Archive to Client ====+===== scp =====
  
 **** ****
  
-  scp espionage724@192.168.1.152:~/'dokuwiki-files-'*'.tar.gz' ~/'Downloads' && sync+  scp espionage724@192.168.1.152:~/'dokuwiki-files-'*'.tar.gz' ~/'Downloads'
  
 ====== Restore ====== ====== Restore ======
  
-===== Client ===== +===== scp =====
- +
-==== Transfer Archive to Server ====+
  
 **** ****
Line 317: Line 311:
   scp ~/'Downloads/dokuwiki-files-'*'.tar.gz' espionage724@192.168.1.152:~   scp ~/'Downloads/dokuwiki-files-'*'.tar.gz' espionage724@192.168.1.152:~
  
-==== Remove Archive ====+===== Stop nginx =====
  
 **** ****
  
-  rm ~/'Downloads/dokuwiki-files-'*'.tar.gz' && sync +  sudo systemctl stop 'nginx'
- +
-===== Server =====+
  
-==== Stop nginx ====+===== Remove Existing Files =====
  
 **** ****
  
-  sudo systemctl stop 'nginx'+  ls ~/'dokuwiki-files-'*'.tar.gz' && sudo rm -Rf '/srv/www/wiki/data/pages' '/srv/www/wiki/data/meta' '/srv/www/wiki/data/media' '/srv/www/wiki/data/media_meta' '/srv/www/wiki/data/attic' '/srv/www/wiki/data/media_attic' '/srv/www/wiki/conf'
  
-==== Remove Previous Folders ====+===== Restore Files =====
  
 **** ****
  
-  ls ~/'dokuwiki-files-'*'.tar.gz' && sudo rm -Rf '/var/www/wiki/data/pages' '/var/www/wiki/data/meta' '/var/www/wiki/data/media' '/var/www/wiki/data/media_meta' '/var/www/wiki/data/attic' '/var/www/wiki/data/media_attic' '/var/www/wiki/conf'+  sudo tar -xzf ~/'dokuwiki-files-'*'.tar.gz' -'/srv/www/wiki' 'data/pages' 'data/meta' 'data/media' 'data/media_meta' 'data/attic' 'data/media_attic' 'conf' && sudo chown -R 'wwwrun' '/srv/www/wiki' && sudo chmod -R '0755' '/srv/www/wiki'
  
-==== Restore Folders ====+===== dos2unix =====
  
 **** ****
  
-  cd '/var/www/wiki' && sudo tar -xvzf ~/'dokuwiki-files-'*'.tar.gz' 'data/pages' 'data/meta' 'data/media' 'data/media_meta' 'data/attic' 'data/media_attic' 'conf' && sudo restorecon -F -I -R '/var/www/wiki' && sudo chown -R 'nginx':'nginx' '/var/www/wiki' && cd ~ && sync+  find '/srv/www/wiki' -type f -print0 | sudo xargs -0 dos2unix -- && sudo chown -R 'wwwrun':'www' '/srv/www/wiki' && sudo chmod -R '0755' '/srv/www/wiki'
  
-==== Start nginx ====+===== Start nginx =====
  
 **** ****
Line 349: Line 341:
   sudo systemctl start 'nginx'   sudo systemctl start 'nginx'
  
-==== Remove Archive ====+===== Clean-up =====
  
-  Verify that DokuWiki works before running+****
  
-  rm -~/'dokuwiki-files-'*'.tar.gz' && sync+  rm -fv ~/'dokuwiki-files-'*'.tar.gz'
  
/srv/www/wiki/data/attic/servers/linux/nginx/dokuwiki.1723601756.txt.gz · Last modified: by Sean Rhone