| Both sides previous revisionPrevious revisionNext revision | Previous revision |
| servers:bsd:nginx:mybb [2026/01/09 14:13] – Sean Rhone | servers:bsd:nginx:mybb [2026/01/09 17:22] (current) – [MySQL Connection] Sean Rhone |
|---|
| |
| ; User/Group | ; User/Group |
| user = www | user = "www" |
| group = www | group = "www" |
| |
| ; Socket | ; Socket |
| listen = 127.0.0.1:9006 | listen = "127.0.0.1:9006" |
| listen.allowed_clients = 127.0.0.1 | listen.allowed_clients = "127.0.0.1" |
| |
| ; 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" |
| |
| ; General | ; Logging |
| php_value[date.timezone] = "America/New_York" | php_value[log_errors] = "Off" |
| | |
| ; Errors | |
| php_value[error_reporting] = "~E_ALL" | php_value[error_reporting] = "~E_ALL" |
| php_value[display_errors] = "Off" | php_value[display_errors] = "Off" |
| | php_value[display_startup_errors] = "Off" |
| | php_value[html_errors] = "Off" |
| | |
| | ; General |
| | php_value[date.timezone] = "America/New_York" |
| |
| ; End</code> | ; End</code> |
| |
| <code> | <code> |
| location ~ \.(php|phar)(/.*)?$ { | location '~' '\.(php|phar)(/.*)?$' { |
| fastcgi_split_path_info ^(.+\.(?:php|phar))(/.*)$; | fastcgi_split_path_info '^(.+\.(?:php|phar))(/.*)$'; |
| fastcgi_intercept_errors on; | fastcgi_intercept_errors 'on'; |
| fastcgi_index index.php; | fastcgi_index 'index.php'; |
| include fastcgi_params; | include 'fastcgi_params'; |
| 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_param HTTPS on; | fastcgi_param 'HTTPS' 'on'; |
| fastcgi_pass 127.0.0.1:9006; | |
| | fastcgi_pass '127.0.0.1:9006'; |
| } | } |
| |
| <code> | <code> |
| server { | server { |
| listen 443 ssl; | listen '443' 'ssl'; |
| http2 on; | http2 'on'; |
| server_name 'forums.realmofespionage.xyz'; | server_name 'forums.realmofespionage.xyz'; |
| root '/usr/local/www/forum'; | root '/usr/local/www/forum'; |
| index 'index.php'; | index 'index.php'; |
| |
| include '/usr/local/etc/freenginx/default.d/forum.conf'; | include '/usr/local/etc/freenginx/default.d/forum.conf'; |
| include '/usr/local/etc/freenginx/default.d/headers.conf'; | include '/usr/local/etc/freenginx/default.d/headers.conf'; |
| |
| client_max_body_size '10M'; | # access_log '/var/log/nginx/forum-access.log'; |
| | # error_log '/var/log/nginx/forum-error.log'; |
| |
| # access_log /var/log/nginx/forum-access.log; | location '/' { |
| # error_log /var/log/nginx/forum-error.log; | 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'; |
| | } |
| } | } |
| |
| 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> |
| |
| ===== config.php ===== | |
| |
| su - | |
| |
| su -m 'www' -c "ee '/usr/local/www/forum/inc/config.php'" | |
| |
| <code>$config['hide_admin_links'] = 1;</code> | |
| |
| ====== Scripts ====== | ====== Scripts ====== |
| #!/bin/sh | #!/bin/sh |
| |
| su -m 'www' -c "git -C '/usr/local/www/forum' reset --hard 'origin/feature'" | cd '/tmp' |
| su -m 'www' -c "git -C '/usr/local/www/forum' pull 'origin' 'feature' --rebase" | |
| | '/usr/bin/su' -m 'www' -c "'/usr/local/bin/git' -C '/usr/local/www/forum' reset --hard 'origin/feature'" |
| | '/usr/bin/su' -m 'www' -c "'/usr/local/bin/git' -C '/usr/local/www/forum' pull 'origin' 'feature' --rebase" |
| | |
| | '/bin/sync' |
| |
| # End</code> | # End</code> |
| cd '/tmp' | cd '/tmp' |
| |
| '/usr/bin/tar' -czf '/home/espionage724/backups/piwigo-files-auto-'$(date +%Y-%m-%d)'.tar.gz' -C '/usr/local/www' 'media' | '/usr/bin/tar' -czf '/home/espionage724/backups/mybb-files-auto-'$(date +%Y-%m-%d)'.tar.gz' -C '/usr/local/www' 'forum' |
| |
| '/usr/local/bin/mariadb-dump' --single-transaction --quick 'piwigo' -r '/home/espionage724/backups/piwigo-database-auto-'$(date +%Y-%m-%d)'.sql' | '/usr/local/bin/mariadb-dump' --single-transaction --quick 'mybb' -r '/home/espionage724/backups/mybb-database-auto-'$(date +%Y-%m-%d)'.sql' |
| |
| '/bin/sync' | '/bin/sync' |
| #!/bin/sh | #!/bin/sh |
| |
| su -m 'www' -c "'/usr/local/bin/git' -C '/usr/local/www/blog' gc --aggressive --prune='all'" | cd '/tmp' |
| su -m 'www' -c "'/usr/local/bin/git' -C '/usr/local/www/blog' fsck --full --strict" | |
| |
| '/usr/local/bin/mariadb-check' -o -f -e --auto-repair 'wordpress' | '/usr/bin/su' -m 'www' -c "'/usr/local/bin/git' -C '/usr/local/www/forum' gc --aggressive --prune='all'" |
| | '/usr/bin/su' -m 'www' -c "'/usr/local/bin/git' -C '/usr/local/www/forum' fsck --full --strict" |
| |
| # End</code> | # End</code> |
| |
| * :!: Set email for ''user.email'' | * :!: Set email for ''user.email'' |
| * :!: [[#initial_setup|Initial set-up]] needs re-completed for database connection ((re-use existing details)) | |
| |
| mkdir -p ~/'.local/scripts/www/blog' && ee ~/'.local/scripts/www/blog/git-fix.sh' && chmod +x ~/'.local/scripts/www/blog/git-fix.sh' | mkdir -p ~/'.local/scripts/www/forum' && ee ~/'.local/scripts/www/forum/git-fix.sh' && chmod +x ~/'.local/scripts/www/forum/git-fix.sh' |
| |
| <code> | <code> |
| #!/bin/sh | #!/bin/sh |
| |
| su -m 'www' -c "rm -Rf '/usr/local/www/blog/.git'" | cd '/tmp' |
| su -m 'www' -c "git -C '/usr/local/www/blog' init --initial-branch='master'" | |
| su -m 'www' -c "git -C '/usr/local/www/blog' add '.'" | |
| |
| ################################################## | '/usr/bin/su' -m 'www' -c "'/bin/rm' -Rf '/usr/local/www/forum/.git'" |
| su -m 'www' -c "git -C '/usr/local/www/blog' config 'user.email' 'espionage724@x'" | '/usr/bin/su' -m 'www' -c "'/usr/local/bin/git' -C '/usr/local/www/forum' init --initial-branch='feature'" |
| ################################################## | '/usr/bin/su' -m 'www' -c "'/usr/local/bin/git' -C '/usr/local/www/forum' add '.'" |
| |
| su -m 'www' -c "git -C '/usr/local/www/blog' commit --message='x'" | ######################################## |
| | '/usr/bin/su' -m 'www' -c "'/usr/local/bin/git' -C '/usr/local/www/forum' config 'user.email' 'espionage724@x'" |
| | ######################################## |
| |
| su -m 'www' -c "git -C '/usr/local/www/blog' remote add 'origin' 'https://github.com/WordPress/WordPress.git'" | '/usr/bin/su' -m 'www' -c "'/usr/local/bin/git' -C '/usr/local/www/forum' commit --message='x'" |
| su -m 'www' -c "git -C '/usr/local/www/blog' pull --depth '1' --recurse-submodules 'origin' 'master' --rebase" | |
| |
| su -m 'www' -c "git -C '/usr/local/www/blog' reset --hard 'origin/master'" | '/usr/bin/su' -m 'www' -c "'/usr/local/bin/git' -C '/usr/local/www/forum' remote add 'origin' 'https://github.com/mybb/mybb.git'" |
| su -m 'www' -c "git -C '/usr/local/www/blog' gc --aggressive --prune='all'" | '/usr/bin/su' -m 'www' -c "'/usr/local/bin/git' -C '/usr/local/www/forum' pull --depth '1' --recurse-submodules 'origin' 'feature' --rebase" |
| su -m 'www' -c "git -C '/usr/local/www/blog' fsck --full --strict" | |
| | '/usr/bin/su' -m 'www' -c "'/usr/local/bin/git' -C '/usr/local/www/forum' reset --hard 'origin/feature'" |
| | '/usr/bin/su' -m 'www' -c "'/usr/local/bin/git' -C '/usr/local/www/forum' gc --aggressive --prune='all'" |
| | '/usr/bin/su' -m 'www' -c "'/usr/local/bin/git' -C '/usr/local/www/forum' fsck --full --strict" |
| | |
| | '/bin/sync' |
| |
| # End</code> | # End</code> |
| su | su |
| |
| rm -Rf '/usr/local/www/forum' | ls '/home/'$USER'/mybb-files-'*'.tar.gz' && rm -Rf '/usr/local/www/forum' |
| |
| tar -xzf '/home/'$USER/'mybb-files-'*'.tar.gz' -C '/usr/local/www' 'forum' && chown -R 'www':'www' '/usr/local/www/forum' && sync | tar -xzf '/home/'$USER'/mybb-files-'*'.tar.gz' -C '/usr/local/www' 'forum' && chown -R 'www':'www' '/usr/local/www/forum' && sync |
| |
| ===== Database ===== | ===== Database ===== |
| su - | su - |
| |
| su -m 'www' -c "ee '/usr/local/www/forum/inc/config.php'" | su -m 'www' -c "ee '/usr/local/www/forum/inc/config.php'" && clear |
| |
| <code>$config['database']['hostname'] = '127.0.0.1';</code> | <code>$config['database']['hostname'] = '127.0.0.1';</code> |
| |