User Tools

Site Tools


servers:linux:nginx:mybb

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
servers:linux:nginx:mybb [2025/12/22 03:58] – [Server Block] Sean Rhoneservers:linux:nginx:mybb [2025/12/22 04:47] (current) – [Restore Files] Sean Rhone
Line 113: Line 113:
  
  location '/' {  location '/' {
- rewrite '^/forum-([0-9]+)\.html$' '/forumdisplay.php?fid=$1'; +  rewrite '^/forum-([0-9]+)\.html$' '/forumdisplay.php?fid=$1'; 
- rewrite '^/forum-([0-9]+)-page-([0-9]+)\.html$' '/forumdisplay.php?fid=$1&page=$2'; +  rewrite '^/forum-([0-9]+)-page-([0-9]+)\.html$' '/forumdisplay.php?fid=$1&page=$2'; 
- rewrite '^/thread-([0-9]+)\.html$' '/showthread.php?tid=$1'; +  rewrite '^/thread-([0-9]+)\.html$' '/showthread.php?tid=$1'; 
- rewrite ^/thread-([0-9]+)-page-([0-9]+)\.html$ /showthread.php?tid=$1&page=$2; +  rewrite '^/thread-([0-9]+)-page-([0-9]+)\.html$' '/showthread.php?tid=$1&page=$2'
- rewrite ^/thread-([0-9]+)-lastpost\.html$ /showthread.php?tid=$1&action=lastpost; +  rewrite '^/thread-([0-9]+)-lastpost\.html$' '/showthread.php?tid=$1&action=lastpost'
- rewrite ^/thread-([0-9]+)-nextnewest\.html$ /showthread.php?tid=$1&action=nextnewest; +  rewrite '^/thread-([0-9]+)-nextnewest\.html$' '/showthread.php?tid=$1&action=nextnewest'
- rewrite ^/thread-([0-9]+)-nextoldest\.html$ /showthread.php?tid=$1&action=nextoldest; +  rewrite '^/thread-([0-9]+)-nextoldest\.html$' '/showthread.php?tid=$1&action=nextoldest'
- rewrite ^/thread-([0-9]+)-newpost\.html$ /showthread.php?tid=$1&action=newpost; +  rewrite '^/thread-([0-9]+)-newpost\.html$' '/showthread.php?tid=$1&action=newpost'
- rewrite ^/thread-([0-9]+)-post-([0-9]+)\.html$ /showthread.php?tid=$1&pid=$2;+  rewrite '^/thread-([0-9]+)-post-([0-9]+)\.html$' '/showthread.php?tid=$1&pid=$2';
  
- rewrite '^/post-([0-9]+)\.html$' '/showthread.php?pid=$1';+  rewrite '^/post-([0-9]+)\.html$' '/showthread.php?pid=$1';
  
- rewrite '^/announcement-([0-9]+)\.html$' '/announcements.php?aid=$1';+  rewrite '^/announcement-([0-9]+)\.html$' '/announcements.php?aid=$1';
  
- rewrite '^/user-([0-9]+)\.html$' '/member.php?action=profile&uid=$1';+  rewrite '^/user-([0-9]+)\.html$' '/member.php?action=profile&uid=$1';
  
- rewrite '^/calendar-([0-9]+)\.html$' '/calendar.php?calendar=$1'; +  rewrite '^/calendar-([0-9]+)\.html$' '/calendar.php?calendar=$1'; 
- rewrite '^/calendar-([0-9]+)-year-([0-9]+)\.html$' '/calendar.php?action=yearview&calendar=$1&year=$2'; +  rewrite '^/calendar-([0-9]+)-year-([0-9]+)\.html$' '/calendar.php?action=yearview&calendar=$1&year=$2'; 
- rewrite '^/calendar-([0-9]+)-year-([0-9]+)-month-([0-9]+)\.html$' '/calendar.php?calendar=$1&year=$2&month=$3'; +  rewrite '^/calendar-([0-9]+)-year-([0-9]+)-month-([0-9]+)\.html$' '/calendar.php?calendar=$1&year=$2&month=$3'; 
- rewrite '^/calendar-([0-9]+)-year-([0-9]+)-month-([0-9]+)-day-([0-9]+)\.html$' '/calendar.php?action=dayview&calendar=$1&year=$2&month=$3&day=$4'; +  rewrite '^/calendar-([0-9]+)-year-([0-9]+)-month-([0-9]+)-day-([0-9]+)\.html$' '/calendar.php?action=dayview&calendar=$1&year=$2&month=$3&day=$4'; 
- rewrite '^/calendar-([0-9]+)-week-(n?[0-9]+)\.html$' '/calendar.php?action=weekview&calendar=$1&week=$2';+  rewrite '^/calendar-([0-9]+)-week-(n?[0-9]+)\.html$' '/calendar.php?action=weekview&calendar=$1&week=$2';
  
- rewrite '^/event-([0-9]+)\.html$' '/calendar.php?action=event&eid=$1';+  rewrite '^/event-([0-9]+)\.html$' '/calendar.php?action=event&eid=$1';
  }  }
  
Line 171: Line 171:
 **** ****
  
-  sudo -u 'www-data' -e '/var/www/forum/inc/config.php'ww/forum/inc/config.php'+  sudo -u 'www-data' -e '/var/www/forum/inc/config.php' 
 + 
 +====== Scripts ====== 
 + 
 +===== Git Fix ===== 
 + 
 +  * :!: Set email for ''user.email'' 
 + 
 +  sudo mkdir -p '/etc/nginx/scripts/forum' && sudo -e '/etc/nginx/scripts/forum/git-fix.sh' && sudo chmod '0500' '/etc/nginx/scripts/forum/git-fix.sh' && sudo chown 'www-data':'www-data' '/etc/nginx/scripts/forum/git-fix.sh' 
 + 
 +<code> 
 +#!/bin/bash 
 + 
 +cd '/tmp' 
 + 
 +'/usr/bin/rm' -Rf '/var/www/forum/.git' 
 +'/usr/bin/git' -C '/var/www/forum' init --initial-branch='feature' 
 +'/usr/bin/git' -C '/var/www/forum' add '.' 
 + 
 +######################################## 
 +'/usr/bin/git' -C '/var/www/forum' config 'user.email' 'espionage724@x' 
 +######################################## 
 + 
 +'/usr/bin/git' -C '/var/www/forum' commit --message='x' 
 + 
 +'/usr/bin/git' -C '/var/www/forum' remote add 'origin' 'https://github.com/mybb/mybb.git' 
 +'/usr/bin/git' -C '/var/www/forum' pull --depth '1' --recurse-submodules 'origin' 'feature' --rebase 
 + 
 +'/usr/bin/git' -C '/var/www/forum' reset --hard 'origin/feature' 
 +'/usr/bin/git' -C '/var/www/forum' gc --aggressive --prune='all' 
 +'/usr/bin/git' -C '/var/www/forum' fsck --full --strict 
 + 
 +# End</code> 
 + 
 +  sudo -u 'www-data' '/etc/nginx/scripts/forum/git-fix.sh'
  
 ====== Services ====== ====== Services ======
Line 184: Line 218:
 [Service] [Service]
 User=www-data User=www-data
-Group=www+Group=www-data
 Type=oneshot Type=oneshot
  
-Environment="COMPOSER_CACHE_DIR=/dev/null" +WorkingDirectory=/var/www/forum
- +
-ExecStart='/usr/bin/git' -C '/var/www/forum' pull origin 'feature'+
  
-ExecStart='/usr/bin/composer' --working-dir='/var/www/forum' --no-cache install --no-dev+ExecStart='/usr/bin/git' -'/var/www/forum' reset --hard 'origin/feature' 
 +ExecStart='/usr/bin/git' -C '/var/www/forum' pull origin 'feature' --rebase
  
 ExecStartPost='/usr/bin/sync' ExecStartPost='/usr/bin/sync'
Line 199: Line 232:
 ==== Timer ==== ==== Timer ====
  
-  * Every day at ''05:00:00''+  * Daily ''05:00:00 AM''
  
   sudo -e '/etc/systemd/system/forum-up.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'forum-up.timer' --now && sudo systemctl start 'forum-up' && sudo systemctl status 'forum-up' -l   sudo -e '/etc/systemd/system/forum-up.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'forum-up.timer' --now && sudo systemctl start 'forum-up' && sudo systemctl status 'forum-up' -l
Line 229: Line 262:
 [Service] [Service]
 Type=oneshot Type=oneshot
 +
 +WorkingDirectory=/var/www/forum
  
 ExecStart='/usr/bin/bash' -c '"/usr/bin/tar" -czf "/home/CHANGEME/backups/mybb-files-auto-"$$(date +%%Y-%%m-%%d)".tar.gz" -C "/var/www" "forum"' ExecStart='/usr/bin/bash' -c '"/usr/bin/tar" -czf "/home/CHANGEME/backups/mybb-files-auto-"$$(date +%%Y-%%m-%%d)".tar.gz" -C "/var/www" "forum"'
Line 238: Line 273:
 === Timer === === Timer ===
  
-  * ''01'' day of every month at ''05:15:00''+  * Monthly (6th) ''05:15:00 AM''
  
   sudo -e '/etc/systemd/system/forum-fb.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'forum-fb.timer' --now   sudo -e '/etc/systemd/system/forum-fb.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'forum-fb.timer' --now
Line 247: Line 282:
  
 [Timer] [Timer]
-OnCalendar=*-*-01 05:15:00+OnCalendar=*-*-06 05:15:00
 Persistent=true Persistent=true
  
Line 278: Line 313:
 Group=mysql Group=mysql
 Type=oneshot Type=oneshot
 +
 +WorkingDirectory=/var/lib/mysql
  
 ExecStart='/usr/bin/bash' -c '"/usr/bin/mariadb-dump" --defaults-extra-file="/var/lib/mysql/auth/mybb" --single-transaction --quick "mybb" -r "/home/CHANGEME/backups/mybb-database-auto-"$$(date +%%Y-%%m-%%d)".sql"' ExecStart='/usr/bin/bash' -c '"/usr/bin/mariadb-dump" --defaults-extra-file="/var/lib/mysql/auth/mybb" --single-transaction --quick "mybb" -r "/home/CHANGEME/backups/mybb-database-auto-"$$(date +%%Y-%%m-%%d)".sql"'
Line 287: Line 324:
 === Timer === === Timer ===
  
-  * ''01'' day of every month at ''05:10:00''+  * Monthly (6th) ''05:10:00 AM''
  
   sudo -e '/etc/systemd/system/forum-db.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'forum-db.timer' --now && sudo systemctl start 'forum-db' && sudo systemctl status 'forum-db' -l   sudo -e '/etc/systemd/system/forum-db.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'forum-db.timer' --now && sudo systemctl start 'forum-db' && sudo systemctl status 'forum-db' -l
Line 297: Line 334:
  
 [Timer] [Timer]
-OnCalendar=*-*-01 05:10:00+OnCalendar=*-*-06 05:10:00
 Persistent=true Persistent=true
  
Line 314: Line 351:
 [Service] [Service]
 User=www-data User=www-data
-Group=www+Group=www-data
 Type=oneshot Type=oneshot
  
-ExecStart='/usr/bin/git' -C '/var/www/forum' reset --hard+WorkingDirectory=/var/www/forum 
 ExecStart='/usr/bin/git' -C '/var/www/forum' gc --aggressive --prune='all' ExecStart='/usr/bin/git' -C '/var/www/forum' gc --aggressive --prune='all'
 ExecStart='/usr/bin/git' -C '/var/www/forum' fsck --full --strict ExecStart='/usr/bin/git' -C '/var/www/forum' fsck --full --strict
Line 327: Line 365:
 ==== Timer ==== ==== Timer ====
  
-  * ''01'' day of every month at ''05:30:00''+  * Monthly (6th) ''05:30:00 AM''
  
   sudo -e '/etc/systemd/system/forum-m.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'forum-m.timer' --now   sudo -e '/etc/systemd/system/forum-m.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'forum-m.timer' --now
Line 338: Line 376:
  
 [Timer] [Timer]
-OnCalendar=*-*-01 05:30:00+OnCalendar=*-*-06 05:30:00
 Persistent=true Persistent=true
  
Line 392: Line 430:
 **** ****
  
-  sudo tar -xzf ~/'mybb-files-'*'.tar.gz' -C '/var/www' 'forum' && sudo chown -R 'www-data':'www' '/var/www/forum' && sudo chmod -R '0755' '/var/www/forum'+  sudo tar -xzf ~/'mybb-files-'*'.tar.gz' -C '/var/www' 'forum' && sudo chown -R 'www-data':'www-data' '/var/www/forum' && sudo chmod -R '0755' '/var/www/forum'
  
 ===== Git Fix ===== ===== Git Fix =====
/var/www/wiki/data/attic/servers/linux/nginx/mybb.1766393902.txt.gz · Last modified: by Sean Rhone

Except where otherwise noted, content on this wiki is licensed under the following license: CC0 1.0 Universal
CC0 1.0 Universal Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki