User Tools

Site Tools


servers:nginx:dokuwiki

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
servers:nginx:dokuwiki [2019/06/28 21:29]
Sean Rhone
servers:nginx:dokuwiki [2020/04/24 10:09] (current)
Sean Rhone 20.04
Line 7: Line 7:
 ===== Prerequisites ===== ===== Prerequisites =====
  
-  * [[distros:fedora_server|Fedora Server]] +  * [[distros:ubuntu_server|Ubuntu Server]] ((Last tested on 20.04)) 
-  * [[servers:nginx_php_php-fpm | nginx + PHP + PHP-FPM]] +  * [[servers:nginx_php_php-fpm|nginx + PHP + PHP-FPM]] 
-  * [[servers:nginx:lets_encrypt | Let's Encrypt]]+  * [[servers:nginx:lets_encrypt|Let's Encrypt]]
  
 ====== Download Source ====== ====== Download Source ======
Line 15: Line 15:
 **** ****
  
-  sudo git clone --branch 'master' --depth '1' --recurse-submodules 'https://github.com/splitbrain/dokuwiki.git' '/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' '/var/www/wiki' && sudo chown -R 'www-data':'www-data' '/var/www/wiki' && sync
- +
-===== SELinux ===== +
- +
-  sudo semanage fcontext --deleteall "/var/www/wiki(/.*)?" +
- +
-  sudo semanage fcontext --add --type 'httpd_sys_rw_content_t' "/var/www/wiki(/.*)?" +
- +
-  sudo restorecon -R -v '/var/www/wiki'+
  
 ====== nginx + PHP-FPM Configuration ====== ====== nginx + PHP-FPM Configuration ======
Line 29: Line 21:
 ===== PHP-FPM Socket ===== ===== PHP-FPM Socket =====
  
-  sudo -e '/etc/php-fpm.d/wiki.conf' && sudo systemctl restart 'php-fpm'+  sudo -e '/etc/php/7.4/fpm/pool.d/wiki.conf' && sudo systemctl restart 'php7.4-fpm'
  
 <code> <code>
 [wiki] [wiki]
-user = nginx +user = www-data 
-group = nginx+group = www-data
  
-listen = /run/php-fpm/wiki.sock +listen = /run/php/wiki.sock 
-listen.owner = nginx +listen.owner = www-data 
-listen.group = nginx+listen.group = www-data
 listen.allowed_clients = 127.0.0.1 listen.allowed_clients = 127.0.0.1
  
Line 56: Line 48:
 php_value[max_file_uploads] = "100" php_value[max_file_uploads] = "100"
  
-php_value[session.save_handler] = files +php_value[session.save_handler] = "files" 
-php_value[session.save_path] = /var/lib/php/session +php_value[session.save_path] = "/var/lib/php/sessions" 
-php_value[soap.wsdl_cache_dir] = /var/lib/php/wsdlcache +php_value[soap.wsdl_cache_dir] = "/var/lib/php/wsdlcache" 
-php_value[opcache.file_cache] = /var/lib/php/opcache</code>+php_value[opcache.file_cache] = "/var/lib/php/opcache"</code>
  
 ===== FastCGI ===== ===== FastCGI =====
  
-  sudo -e '/etc/nginx/default.d/wiki.conf'+  sudo -e '/etc/nginx/snippets/wiki.conf'
  
 <code> <code>
Line 75: Line 67:
     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_pass unix:/run/php-fpm/wiki.sock;+    fastcgi_pass unix:/run/php/wiki.sock;
 }</code> }</code>
  
 ===== Server Block ====== ===== Server Block ======
  
-  sudo -e '/etc/nginx/conf.d/wiki.conf'+  sudo -e '/etc/nginx/sites-available/wiki.conf'
  
 <code> <code>
Line 89: Line 81:
     index 'doku.php';     index 'doku.php';
  
-    include '/etc/nginx/default.d/wiki.conf'; +    include '/etc/nginx/snippets/wiki.conf'; 
-    include '/etc/nginx/default.d/headers.conf';+    include '/etc/nginx/snippets/headers.conf';
  
     client_max_body_size '10M';     client_max_body_size '10M';
Line 120: Line 112:
     }     }
 }</code> }</code>
 +
 +==== Enable =====
 +
 +****
 +
 +  sudo rm -f '/etc/nginx/sites-enabled/wiki.conf' && sudo ln -s '/etc/nginx/sites-available/wiki.conf' '/etc/nginx/sites-enabled/wiki.conf' && sudo systemctl reload 'nginx' && sync
  
 ====== Initial Setup ====== ====== Initial Setup ======
Line 138: Line 136:
   * Do after initial setup   * Do after initial setup
  
-  sudo -e '/etc/nginx/conf.d/wiki.conf' && sudo systemctl reload 'nginx'+  sudo -e '/etc/nginx/sites-available/wiki.conf' && sudo systemctl reload 'nginx'
  
 ===== URL Rewrite ===== ===== URL Rewrite =====
Line 149: Line 147:
   * 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'+  echo '--      --' | sudo tee '/var/www/wiki/conf/entities.local.conf' > '/dev/null' && sudo chown 'www-data':'www-data' '/var/www/wiki/conf/entities.local.conf'
  
 ====== Services ====== ====== Services ======
Line 161: Line 159:
 <code> <code>
 [Service] [Service]
-User=nginx +User=www-data 
-Group=nginx+Group=www-data
 Type=oneshot Type=oneshot
 ExecStart='/usr/bin/git' -C '/var/www/wiki' pull origin 'master' ExecStart='/usr/bin/git' -C '/var/www/wiki' pull origin 'master'
-ExecStartPost='/usr/bin/sync'</code>+ExecStartPost='/bin/sync'</code>
  
 ==== Timer ==== ==== Timer ====
Line 191: Line 189:
  
 ==== Service ==== ==== Service ====
 +
 +  * :!: The commented ''ExecStart'' would remove page edits older than 90 days
  
   sudo -e '/etc/systemd/system/wiki-m.service'   sudo -e '/etc/systemd/system/wiki-m.service'
Line 196: Line 196:
 <code> <code>
 [Service] [Service]
-User=nginx +User=www-data 
-Group=nginx+Group=www-data
 Type=oneshot Type=oneshot
 WorkingDirectory=/var/www/wiki WorkingDirectory=/var/www/wiki
 ExecStart='/usr/bin/git' -C '/var/www/wiki' gc --aggressive --prune='all' ExecStart='/usr/bin/git' -C '/var/www/wiki' gc --aggressive --prune='all'
 ExecStart='/usr/bin/git' -C '/var/www/wiki' fsck --full --strict ExecStart='/usr/bin/git' -C '/var/www/wiki' fsck --full --strict
-ExecStart='/usr/bin/bash' -c "find '/var/www/wiki/data'/{attic,cache,locks,media_attic}/ -type 'f' -mtime +'90' -delete" +#ExecStart='/bin/bash' -c "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='/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 ExecStart='/usr/bin/php' '/var/www/wiki/bin/indexer.php' --clear
-ExecStartPost='/usr/bin/sync'</code>+ExecStartPost='/bin/sync'</code>
  
 ==== Timer ==== ==== Timer ====
Line 236: Line 236:
 Type=oneshot Type=oneshot
 WorkingDirectory=/var/www/wiki WorkingDirectory=/var/www/wiki
-ExecStart='/usr/bin/bash' -c '"/usr/bin/tar" -cvzf "/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"' +ExecStart='/bin/bash' -c '"/bin/tar" -cvzf "/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"' 
-ExecStartPost='/usr/bin/sync'</code>+ExecStartPost='/bin/sync'</code>
  
 ==== Timer ==== ==== Timer ====
Line 310: Line 310:
 **** ****
  
-  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 chown -R 'nginx':'nginx' '/var/www/wiki' && cd ~ && sync +  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 chown -R 'www-data':'www-data' '/var/www/wiki' && cd ~ && sync
- +
-==== SELinux ==== +
- +
-  sudo semanage fcontext --deleteall "/var/www/wiki(/.*)?" +
- +
-  sudo semanage fcontext --add --type 'httpd_sys_rw_content_t' "/var/www/wiki(/.*)?" +
- +
-  sudo restorecon -R -v '/var/www/wiki'+
  
 ==== Start nginx ==== ==== Start nginx ====
servers/nginx/dokuwiki.1561771784.txt.gz · Last modified: 2019/06/28 21:29 by Sean Rhone