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/10/16 23:47] – [config.php] Sean Rhoneservers:linux:nginx:mybb [2025/12/22 04:47] (current) – [Restore Files] Sean Rhone
Line 7: Line 7:
 ===== Prerequisites ===== ===== Prerequisites =====
  
-  * [[linux:distros:server:opensuse_tumbleweed_server|openSUSE Tumbleweed (Server)]]+  * [[linux:distros:server:ubuntu_server|Ubuntu Server]]
   * [[servers:linux:nginx_php_php-fpm|nginx + PHP + PHP-FPM]]   * [[servers:linux:nginx_php_php-fpm|nginx + PHP + PHP-FPM]]
   * [[servers:linux:nginx:lets_encrypt|Certbot (Let's Encrypt)]]   * [[servers:linux:nginx:lets_encrypt|Certbot (Let's Encrypt)]]
Line 17: Line 17:
   * https://docs.mybb.com/1.8/install/anonymous-statistics/   * https://docs.mybb.com/1.8/install/anonymous-statistics/
  
-  sudo zypper install php-composer2+  sudo apt install php-gd php-mbstring php-xml php-mysql
  
 ====== Download Source ====== ====== Download Source ======
  
-  * https://github.com/mybb/mybb/commits/dev-1.9/+  * https://github.com/mybb/mybb/commits/feature/
  
-  sudo git clone --branch 'dev-1.9' --depth '1' --recurse-submodules 'https://github.com/mybb/mybb.git' '/srv/www/forum' && sudo chown -R 'wwwrun':'www' '/srv/www/forum' && sudo chmod -R '0755' '/srv/www/forum' +  sudo git clone --branch 'feature' --depth '1' --recurse-submodules 'https://github.com/mybb/mybb.git' '/var/www/forum' && sudo chown -R 'www-data':'www-data' '/var/www/forum' && sudo chmod -R '0755' '/var/www/forum'
- +
-====== Environment ====== +
- +
-  * https://github.com/mybb/mybb/wiki/Getting-started-with-MyBB-1.9-development---Composer +
- +
-===== Composer ===== +
- +
-  sudo su 'wwwrun' -s '/bin/bash' +
- +
-  cd '/tmp' && composer --working-dir='/srv/www/forum' --no-cache install --no-dev +
- +
-  exit+
  
 ====== Database ====== ====== Database ======
Line 53: Line 41:
 ===== PHP-FPM Socket ===== ===== PHP-FPM Socket =====
  
-  sudo -e '/etc/php8/fpm/php-fpm.d/forum.conf' && sudo systemctl restart 'php-fpm'+  sudo -e '/etc/php/8.4/fpm/pool.d/forum.conf' && sudo systemctl restart 'php8.4-fpm'
  
 <code> <code>
Line 59: Line 47:
  
 ; User/Group ; User/Group
-user = "wwwrun+user = "www-data
-group = "www"+group = "www-data"
  
 ; Socket ; Socket
-listen = "/run/php-fpm/forum.sock" +listen = "/run/php/forum.sock" 
-listen.owner = "wwwrun+listen.owner = "www-data
-listen.group = "www"+listen.group = "www-data"
 listen.mode = "0662" listen.mode = "0662"
  
Line 73: Line 61:
 pm.process_idle_timeout = "30" pm.process_idle_timeout = "30"
  
-openSUSE php.ini Defaults +Logging
-php_value[session.save_path] = "/var/lib/php8/sessions" +
- +
-; General+
 php_value[log_errors] = "0" php_value[log_errors] = "0"
 php_value[error_reporting] = "~E_ALL" php_value[error_reporting] = "~E_ALL"
 +
 +; General
 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>
Line 90: Line 72:
 ===== FastCGI ===== ===== FastCGI =====
  
-  * ''forum.sock'' +  sudo -e '/etc/nginx/snippets/forum.conf'
- +
-  sudo -e '/etc/nginx/default.d/forum.conf'+
  
 <code> <code>
-location ~ \.(php|phar)(/.*)?$ { +location '~' '\.(php|phar)(/.*)?$
-    fastcgi_split_path_info ^(.+\.(?:php|phar))(/.*)$; + 
-    fastcgi_intercept_errors on; + fastcgi_split_path_info '^(.+\.(?:php|phar))(/.*)$'
-    fastcgi_index index.php; + fastcgi_intercept_errors 'on'
-    include fastcgi_params; + fastcgi_index 'index.php'
-    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + include 'fastcgi_params'
-    fastcgi_param PATH_INFO $fastcgi_path_info; + fastcgi_param 'SCRIPT_FILENAME' '$document_root$fastcgi_script_name'
-    fastcgi_pass unix:/run/php-fpm/forum.sock;+ fastcgi_param 'PATH_INFO' '$fastcgi_path_info'
 + fastcgi_param 'HTTPS' 'on'; 
 + 
 + fastcgi_pass 'unix:/run/php/forum.sock'; 
 } }
  
 # End</code> # End</code>
  
-===== Server Block =====+===== Server Block ======
  
-  sudo -e '/etc/nginx/vhosts.d/forum.conf' && sudo systemctl reload 'nginx'+  * https://docs.mybb.com/1.8/administration/configuring-search-engine-friendly-URLs/ 
 + 
 +  sudo -e '/etc/nginx/sites-available/forum.conf'
  
 <code> <code>
 server { server {
-    listen '443' 'ssl'; 
-    http2 'on'; 
-    server_name 'forums.realmofespionage.xyz'; 
-    root '/srv/www/forum'; 
-    index 'index.php'; 
  
-    include '/etc/nginx/default.d/forum.conf'; + listen '443' 'ssl'; 
-    include '/etc/nginx/default.d/headers.conf';+ http2 'on'; 
 + server_name 'forums.realmofespionage.xyz'; 
 + root '/var/www/forum'; 
 + index 'index.php';
  
-    client_max_body_size '10M';+ include '/etc/nginx/snippets/forum.conf'; 
 + include '/etc/nginx/snippets/headers.conf';
  
-   access_log  /var/log/nginx/forum-access.log; +# access_log '/var/log/nginx/forum-access.log'
-   error_log  /var/log/nginx/forum-error.log;+# error_log '/var/log/nginx/forum-error.log'; 
 + 
 + location '/'
 +  rewrite '^/forum-([0-9]+)\.html$' '/forumdisplay.php?fid=$1'; 
 +  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]+)-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]+)-nextnewest\.html$' '/showthread.php?tid=$1&action=nextnewest'; 
 +  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]+)-post-([0-9]+)\.html$' '/showthread.php?tid=$1&pid=$2'; 
 + 
 +  rewrite '^/post-([0-9]+)\.html$' '/showthread.php?pid=$1'; 
 + 
 +  rewrite '^/announcement-([0-9]+)\.html$' '/announcements.php?aid=$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]+)-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]+)-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 '^/event-([0-9]+)\.html$' '/calendar.php?action=event&eid=$1'; 
 + }
  
 } }
  
 # End</code> # End</code>
 +
 +  sudo ln -s -f '/etc/nginx/sites-available/forum.conf' '/etc/nginx/sites-enabled/forum.conf' && sudo systemctl reload 'nginx'
  
 ====== Initial Setup ====== ====== Initial Setup ======
 +
 +  * Database Engine: ''MySQL Improved''
 +  * Database Server Hostname: ''localhost''
 +  * Table Encoding: ''4-Byte UTF-8 Unicode''
  
   * https://forums.realmofespionage.xyz   * https://forums.realmofespionage.xyz
  
-====== Settings ======+====== Configuration ======
  
-  * TODO+===== Board Online / Offline =====
  
-===== Offline Message ===== +  * Board Closed: ''[x]'' Yes
- +
-  Configuration -> Settings -> Board Online / Offline+
  
 <code> <code>
 These forums are being built behind-the-scenes, check back later! These forums are being built behind-the-scenes, check back later!
 <br /> <br />
-In the meantime, check out my wiki: <a href="https://wiki.realmofespionage.xyz/">RoE | Wiki</a> +In the meantime, check out my wiki: <a href="https://wiki.realmofespionage.xyz/">RoE | Wiki</a></code> 
-</code>+ 
 +===== Login and Registration ===== 
 + 
 +  * Disable Registrations: ''[x]'' Yes
  
 ===== config.php ===== ===== config.php =====
  
-  https://docs.mybb.com/1.8/administration/utf-8-setup/+****
  
-  sudo -e '/srv/www/forum/inc/config.php' && sudo chown -'wwwrun':'www' '/srv/www/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 -'/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> <code>
-$config['database']['encoding'= 'utf8mb4';</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 168: Line 217:
 <code> <code>
 [Service] [Service]
-User=wwwrun +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 '/srv/www/forum' pull origin 'dev-1.9'+
  
-ExecStart='/usr/bin/composer' --working-dir='/srv/www/forum' --no-cache install+ExecStart='/usr/bin/git' -C '/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 184: 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 215: Line 263:
 Type=oneshot Type=oneshot
  
-ExecStart='/usr/bin/bash' -c '"/usr/bin/tar" -czf "/home/CHANGEME/backups/mybb-files-auto-"$$(date +%%Y-%%m-%%d)".tar.gz" -C "/srv/www" "forum"'+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"'
  
 ExecStartPost='/usr/bin/sync' ExecStartPost='/usr/bin/sync'
Line 223: 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 232: Line 282:
  
 [Timer] [Timer]
-OnCalendar=*-*-01 05:15:00+OnCalendar=*-*-06 05:15:00
 Persistent=true Persistent=true
  
Line 263: 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 272: 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 282: Line 334:
  
 [Timer] [Timer]
-OnCalendar=*-*-01 05:10:00+OnCalendar=*-*-06 05:10:00
 Persistent=true Persistent=true
  
Line 298: Line 350:
 <code> <code>
 [Service] [Service]
-User=wwwrun +User=www-data 
-Group=www+Group=www-data
 Type=oneshot Type=oneshot
  
-ExecStart='/usr/bin/git' -C '/srv/www/forum' reset --hard +WorkingDirectory=/var/www/forum 
-ExecStart='/usr/bin/git' -C '/srv/www/forum' gc --aggressive --prune='all' + 
-ExecStart='/usr/bin/git' -C '/srv/www/forum' fsck --full --strict+ExecStart='/usr/bin/git' -C '/var/www/forum' gc --aggressive --prune='all' 
 +ExecStart='/usr/bin/git' -C '/var/www/forum' fsck --full --strict
  
 ExecStartPost='/usr/bin/sync' ExecStartPost='/usr/bin/sync'
Line 312: 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 323: Line 376:
  
 [Timer] [Timer]
-OnCalendar=*-*-01 05:30:00+OnCalendar=*-*-06 05:30:00
 Persistent=true Persistent=true
  
Line 339: Line 392:
 **** ****
  
-  sudo tar -czf ~/'mybb-files-manual-'$(date +%Y-%m-%d)'.tar.gz' -C '/srv/www' 'forum'+  sudo tar -czf ~/'mybb-files-manual-'$(date +%Y-%m-%d)'.tar.gz' -C '/var/www' 'forum'
  
 ===== Database ===== ===== Database =====
Line 371: Line 424:
 **** ****
  
-  ls ~/'mybb-files-'*'.tar.gz' && sudo rm -Rf '/srv/www/forum'+  ls ~/'mybb-files-'*'.tar.gz' && sudo rm -Rf '/var/www/forum'
  
 ===== Restore Files ===== ===== Restore Files =====
Line 377: Line 430:
 **** ****
  
-  sudo tar -xzf ~/'mybb-files-'*'.tar.gz' -C '/srv/www' 'forum' && sudo chown -R 'wwwrun':'www' '/srv/www/forum' && sudo chmod -R '0755' '/srv/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 =====
Line 383: Line 436:
   * :!: Set email for ''user.email''   * :!: Set email for ''user.email''
  
-  sudo su 'wwwrun' -s '/bin/bash'+  sudo su 'www-data' -s '/bin/bash'
  
-  rm -Rf '/srv/www/forum/.git'+  rm -Rf '/var/www/forum/.git'
  
-  git -C '/srv/www/forum' init --initial-branch='dev-1.9'+  git -C '/var/www/forum' init --initial-branch='feature'
  
-  git -C '/srv/www/forum' add '.'+  git -C '/var/www/forum' add '.'
  
-  git -C '/srv/www/forum' config 'user.email' 'espionage724@x'+  git -C '/var/www/forum' config 'user.email' 'espionage724@x'
  
-  git -C '/srv/www/forum' commit --message='x'+  git -C '/var/www/forum' commit --message='x'
  
-  git -C '/srv/www/forum' remote add 'origin' 'https://github.com/mybb/mybb.git'+  git -C '/var/www/forum' remote add 'origin' 'https://github.com/mybb/mybb.git'
  
-  git -C '/srv/www/forum' pull --depth '1' --recurse-submodules 'origin' 'dev-1.9' --rebase+  git -C '/var/www/forum' pull --depth '1' --recurse-submodules 'origin' 'feature' --rebase
  
-  git -C '/srv/www/forum' reset --hard 'origin/dev-1.9'+  git -C '/var/www/forum' reset --hard 'origin/feature'
  
-  git -C '/srv/www/forum' gc --aggressive --prune='all'+  git -C '/var/www/forum' gc --aggressive --prune='all'
  
-  git -C '/srv/www/forum' fsck --full --strict+  git -C '/var/www/forum' fsck --full --strict
  
   exit   exit
/var/www/wiki/data/attic/servers/linux/nginx/mybb.1760672874.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