| Both sides previous revisionPrevious revisionNext revision | Previous revision |
| servers:bsd:nginx:mybb [2026/01/09 14:37] – [Maintenance] Sean Rhone | servers:bsd:nginx:mybb [2026/07/24 02:37] (current) – Sean Rhone |
|---|
| ===== Prerequisites ===== | ===== Prerequisites ===== |
| |
| * [[bsd:server:freebsd_16.0|FreeBSD 16.0]] | * [[bsd:server:arm:freebsd_15.1|FreeBSD 15.1]] |
| * [[servers:bsd:freenginx_php_php-fpm|freenginx + PHP + PHP-FPM]] | * [[servers:bsd:freenginx_php_php-fpm|freenginx + PHP + PHP-FPM]] |
| * [[servers:bsd:nginx:lets_encrypt|Certbot (Let's Encrypt)]] | * [[servers:bsd:nginx:lets_encrypt|Certbot (Let's Encrypt)]] |
| |
| ; Logging | ; Logging |
| php_value[log_errors] = "Off" | php_value[log_errors] = "0" |
| php_value[error_reporting] = "~E_ALL" | php_value[error_reporting] = "~E_ALL" |
| php_value[display_errors] = "Off" | php_value[display_errors] = "0" |
| php_value[display_startup_errors] = "Off" | php_value[display_startup_errors] = "0" |
| php_value[html_errors] = "Off" | php_value[html_errors] = "0" |
| |
| ; General | ; General |
| fastcgi_pass '127.0.0.1:9006'; | fastcgi_pass '127.0.0.1:9006'; |
| } | } |
| | |
| | # End</code> |
| | |
| | ===== Deny Directive ===== |
| | |
| | * Blocks password reset page and user profile viewing |
| | |
| | su - |
| | |
| | ee '/usr/local/etc/freenginx/default.d/mybb-deny.conf' |
| | |
| | <code> |
| | # Password Reset + User Profile View |
| | location = '/member.php' { |
| | deny 'all'; |
| | } |
| | |
| | # Calendar |
| | location = '/calendar.php' { |
| | deny 'all'; |
| | } |
| |
| # End</code> | # End</code> |
| 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'; |
| | |
| | # include '/usr/local/etc/freenginx/default.d/mybb-deny.conf'; |
| |
| # access_log '/var/log/nginx/forum-access.log'; | # access_log '/var/log/nginx/forum-access.log'; |
| 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> |
| | |
| | ===== nginx Deny Directive ===== |
| | |
| | * Uncomment ''mybb-deny.conf'' include |
| | * :!: Do after forum set-up ((prevents main forum log-in for creating/editing posts later)) |
| | |
| | su - |
| | |
| | ee '/usr/local/etc/freenginx/vhosts.d/forum.conf' && service 'nginx' reload |
| |
| ====== Scripts ====== | ====== Scripts ====== |
| <code> | <code> |
| #!/bin/sh | #!/bin/sh |
| | |
| | cd '/tmp' |
| |
| '/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' reset --hard 'origin/feature'" |
| '/usr/bin/su' -m 'www' -c "'/usr/local/bin/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' pull 'origin' 'feature' --rebase" |
| | |
| | '/bin/sync' |
| |
| # End</code> | # End</code> |
| |
| ===== Backup ===== | ===== Backup ===== |
| | |
| | * [[bsd:notes:ufs_format|UFS NAS]] |
| |
| mkdir -p ~/'backups' ~/'.local/scripts/www/forum' && ee ~/'.local/scripts/www/forum/backup.sh' && chmod +x ~/'.local/scripts/www/forum/backup.sh' | mkdir -p ~/'backups' ~/'.local/scripts/www/forum' && ee ~/'.local/scripts/www/forum/backup.sh' && chmod +x ~/'.local/scripts/www/forum/backup.sh' |
| cd '/tmp' | cd '/tmp' |
| |
| '/usr/bin/tar' -czf '/home/espionage724/backups/mybb-files-auto-'$(date +%Y-%m-%d)'.tar.gz' -C '/usr/local/www' 'forum' | '/usr/bin/tar' -czf '/mnt/NAS1/Servers/Scheduled Backups/mybb-files-auto-'$(date +%Y-%m-%d)'.tar.gz' -C '/usr/local/www' 'forum' |
| | '/usr/local/bin/mariadb-dump' --single-transaction --quick 'mybb' -r '/mnt/NAS1/Servers/Scheduled Backups/mybb-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' | #'/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 'mybb' -r '/home/espionage724/backups/mybb-database-auto-'$(date +%Y-%m-%d)'.sql' |
| |
| '/bin/sync' | '/bin/sync' |
| |
| * :!: 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/forum' && ee ~/'.local/scripts/www/forum/git-fix.sh' && chmod +x ~/'.local/scripts/www/forum/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' |
| |
| ===== scp ===== | ===== scp ===== |
| |
| **** | |
| |
| scp espionage724@192.168.1.152:~/'mybb-files-'*'.tar.gz' espionage724@192.168.1.152:~/'mybb-database-'*'.sql' ~/'Downloads' | scp espionage724@192.168.1.152:~/'mybb-files-'*'.tar.gz' espionage724@192.168.1.152:~/'mybb-database-'*'.sql' ~/'Downloads' |
| |
| ===== scp ===== | ===== scp ===== |
| |
| **** | |
| |
| scp ~/'Downloads/mybb-files-'*'.tar.gz' ~/'Downloads/mybb'*'.sql' espionage724@192.168.1.152:~ | scp ~/'Downloads/mybb-files-'*'.tar.gz' ~/'Downloads/mybb'*'.sql' espionage724@192.168.1.152:~ |
| 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 |
| 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> |
| |