| Both sides previous revisionPrevious revisionNext revision | Previous revision |
| servers:bsd:nginx:mybb [2026/01/09 14:31] – [Git Fix] Sean Rhone | servers:bsd:nginx:mybb [2026/07/08 18:05] (current) – [Deny Directive] Sean Rhone |
|---|
| ===== Prerequisites ===== | ===== Prerequisites ===== |
| |
| * [[bsd:server:freebsd_16.0|FreeBSD 16.0]] | * [[bsd:server:arm:freebsd_16.0|FreeBSD 16.0]] |
| * [[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)]] |
| 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 ====== |
| #!/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/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/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' |
| 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> |
| |