Both sides previous revisionPrevious revisionNext revision | Previous revision |
servers:linux:nginx:dokuwiki [2025/07/15 18:36] – [Service] Sean Rhone | servers:linux:nginx:dokuwiki [2025/07/16 14:06] (current) – [Service] Sean Rhone |
---|
* https://github.com/dokuwiki/dokuwiki/commits/master/ | * https://github.com/dokuwiki/dokuwiki/commits/master/ |
| |
sudo git clone --branch 'master' --depth '1' --recurse-submodules 'https://github.com/splitbrain/dokuwiki.git' '/srv/www/wiki' && sudo chown -R 'wwwrun' '/srv/www/wiki' | sudo git clone --branch 'master' --depth '1' --recurse-submodules 'https://github.com/splitbrain/dokuwiki.git' '/srv/www/wiki' && sudo chown -R 'wwwrun':'www' '/srv/www/wiki' |
| |
sudo semanage fcontext --add --type 'httpd_sys_rw_content_t' '/srv/www/wiki(/.*)?' && sudo restorecon -F -I -R '/srv/www/wiki' | |
| |
====== nginx + PHP-FPM Configuration ====== | ====== nginx + PHP-FPM Configuration ====== |
| |
<code> | <code> |
; php-fpm.d/wiki.conf | |
| |
[wiki] | [wiki] |
| |
| |
===== 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))(/.*)$; |
* 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 '/srv/www/wiki/conf/entities.local.conf' > '/dev/null' && sudo chown 'nginx':'nginx' '/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' |
| |
====== Services ====== | ====== Services ====== |
[Service] | [Service] |
User=wwwrun | User=wwwrun |
#Group=www | Group=www |
Type=oneshot | Type=oneshot |
ExecStart='/usr/bin/git' -C '/srv/www/wiki' pull origin 'master' | ExecStart='/usr/bin/git' -C '/srv/www/wiki' pull origin 'master' |
[Service] | [Service] |
User=wwwrun | User=wwwrun |
#Group=www | Group=www |
Type=oneshot | Type=oneshot |
WorkingDirectory=/srv/www/wiki | WorkingDirectory=/srv/www/wiki |
===== Backup ===== | ===== Backup ===== |
| |
* This backs up an archive to the local disk and to a NAS | * This backs up an archive to the local disk |
| |
==== Service ==== | ==== Service ==== |
| |
* The extra ''ExecStart''s are additional backup locations that expect [[servers:linux:vsftpd#fstab1|vsftpd]] | |
* 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' | mkdir -p ~/'backups' && sudo -e '/etc/systemd/system/wiki-fb.service' && sudo sed -i 's/CHANGEME/'$USER'/g' '/etc/systemd/system/wiki-fb.service' |
WorkingDirectory=/srv/www/wiki | WorkingDirectory=/srv/www/wiki |
ExecStart='/usr/bin/bash' -c '"/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"' | ExecStart='/usr/bin/bash' -c '"/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"' |
#ExecStart='/usr/bin/bash' -c '"/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"' | |
ExecStartPost='/usr/bin/sync' | ExecStartPost='/usr/bin/sync' |
| |
==== Restore Folders ==== | ==== Restore Folders ==== |
| |
* TODO: ''tar -C'' | * TODO: ''tar -C or --directory='' |
| |
cd '/srv/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 '/srv/www/wiki' && sudo chown -R 'wwwrun' '/srv/www/wiki' && cd ~ && sync | cd '/srv/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 'wwwrun' '/srv/www/wiki' && cd ~ && sync |
| |
==== Start nginx ==== | ==== Start nginx ==== |