| Both sides previous revisionPrevious revisionNext revision | Previous revision |
| servers:linux:nginx:wordpress [2025/12/20 23:22] – Sean Rhone | servers:linux:nginx:wordpress [2025/12/21 00:43] (current) – [Git Fix] Sean Rhone |
|---|
| ===== wp-config.php ===== | ===== wp-config.php ===== |
| |
| * :!: WordPress set-up needs to generate this file first ((put settings in the ''custom values'' section towards the bottom)) | * https://github.com/WordPress/WordPress/blob/master/wp-config-sample.php |
| | * https://developer.wordpress.org/advanced-administration/wordpress/wp-config/ |
| | |
| | * :!: Change ''DB_PASSWORD'' |
| |
| sudo -u 'www-data' -e '/var/www/blog/wp-config.php' | sudo -u 'www-data' -e '/var/www/blog/wp-config.php' |
| |
| <code> | <code> |
| define( 'AUTOMATIC_UPDATER_DISABLED', true ); | <?php |
| |
| | define( 'DB_NAME', 'wordpress' ); |
| | define( 'DB_USER', 'wordpress' ); |
| | define( 'DB_PASSWORD', 'x' ); |
| | define( 'DB_HOST', 'localhost' ); |
| | define( 'DB_CHARSET', 'utf8mb4' ); |
| | $table_prefix = 'wp_'; |
| | |
| | define( 'AUTOMATIC_UPDATER_DISABLED', true ); |
| define( 'WP_DEBUG', false ); | define( 'WP_DEBUG', false ); |
| define( 'WP_DEBUG_DISPLAY', false ); | define( 'WP_DEBUG_DISPLAY', false ); |
| |
| /* End */</code> | if ( ! defined( 'ABSPATH' ) ) { |
| | define( 'ABSPATH', __DIR__ . '/' ); |
| | } |
| | |
| | require_once ABSPATH . 'wp-settings.php'; |
| | |
| | // End</code> |
| | |
| | ====== Scripts ====== |
| | |
| | ===== Git Fix ===== |
| | |
| | * :!: Set email for ''user.email'' |
| | |
| | sudo mkdir -p '/etc/nginx/scripts/blog' && sudo -e '/etc/nginx/scripts/blog/git-fix.sh' && sudo chmod '0500' '/etc/nginx/scripts/blog/git-fix.sh' && sudo chown 'www-data':'www-data' '/etc/nginx/scripts/blog/git-fix.sh' |
| | |
| | <code> |
| | #!/bin/bash |
| | |
| | '/usr/bin/rm' -Rf '/tmp/blog' |
| | '/usr/bin/mkdir' -p '/tmp/blog' |
| | '/usr/bin/cp' -Rf '/var/www/blog/wp-content/uploads' '/var/www/blog/wp-config.php' '/tmp/blog' |
| | |
| | '/usr/bin/rm' -Rf '/var/www/blog/.git' |
| | '/usr/bin/git' -C '/var/www/blog' init --initial-branch='master' |
| | '/usr/bin/git' -C '/var/www/blog' add '.' |
| | |
| | ######################################## |
| | '/usr/bin/git' -C '/var/www/blog' config 'user.email' 'espionage724@x' |
| | ######################################## |
| | |
| | '/usr/bin/git' -C '/var/www/blog' commit --message='x' |
| | |
| | '/usr/bin/git' -C '/var/www/blog' remote add 'origin' 'https://github.com/WordPress/WordPress.git' |
| | '/usr/bin/git' -C '/var/www/blog' pull --depth '1' --recurse-submodules 'origin' 'master' --rebase |
| | |
| | '/usr/bin/git' -C '/var/www/blog' reset --hard 'origin/master' |
| | '/usr/bin/git' -C '/var/www/blog' gc --aggressive --prune='all' |
| | '/usr/bin/git' -C '/var/www/blog' fsck --full --strict |
| | |
| | '/usr/bin/cp' -Rf '/tmp/blog/uploads' '/var/www/blog/wp-content' |
| | '/usr/bin/cp' -f '/tmp/blog/wp-config.php' '/var/www/blog/wp-config.php' |
| | '/usr/bin/rm' -Rf '/tmp/blog' |
| | |
| | # End</code> |
| | |
| | sudo -u 'www-data' '/etc/nginx/scripts/blog/git-fix.sh' |
| |
| ====== Services ====== | ====== Services ====== |
| Type=oneshot | Type=oneshot |
| |
| ExecStart='/usr/bin/git' -C '/var/www/blog' pull origin 'master' | WorkingDirectory=/var/www/blog |
| | |
| | ExecStart='/usr/bin/git' -C '/var/www/blog' reset --hard |
| | ExecStart='/usr/bin/git' -C '/var/www/blog' pull origin 'master' --rebase |
| |
| ExecStartPost='/usr/bin/sync' | ExecStartPost='/usr/bin/sync' |
| ==== Timer ==== | ==== Timer ==== |
| |
| * Every day at ''02:00:00'' | * Daily ''02:00:00 AM'' |
| |
| sudo -e '/etc/systemd/system/blog-up.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'blog-up.timer' --now && sudo systemctl start 'blog-up' && sudo systemctl status 'blog-up' -l | sudo -e '/etc/systemd/system/blog-up.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'blog-up.timer' --now && sudo systemctl start 'blog-up' && sudo systemctl status 'blog-up' -l |
| [Service] | [Service] |
| Type=oneshot | Type=oneshot |
| | |
| | WorkingDirectory=/var/www/blog |
| |
| ExecStart='/usr/bin/bash' -c '"/usr/bin/tar" -czf "/home/CHANGEME/backups/wordpress-files-auto-"$$(date +%%Y-%%m-%%d)".tar.gz" -C "/var/www" "blog"' | ExecStart='/usr/bin/bash' -c '"/usr/bin/tar" -czf "/home/CHANGEME/backups/wordpress-files-auto-"$$(date +%%Y-%%m-%%d)".tar.gz" -C "/var/www" "blog"' |
| === Timer === | === Timer === |
| |
| * ''01'' day of every month at ''02:15:00'' | * Monthly (3rd) ''02:15:00 AM'' |
| |
| sudo -e '/etc/systemd/system/blog-fb.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'blog-fb.timer' --now | sudo -e '/etc/systemd/system/blog-fb.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'blog-fb.timer' --now |
| |
| [Timer] | [Timer] |
| OnCalendar=*-*-01 02:15:00 | OnCalendar=*-*-03 02:15:00 |
| Persistent=true | Persistent=true |
| |
| 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/wordpress" --single-transaction --quick "wordpress" -r "/home/CHANGEME/backups/wordpress-database-auto-"$$(date +%%Y-%%m-%%d)".sql"' | ExecStart='/usr/bin/bash' -c '"/usr/bin/mariadb-dump" --defaults-extra-file="/var/lib/mysql/auth/wordpress" --single-transaction --quick "wordpress" -r "/home/CHANGEME/backups/wordpress-database-auto-"$$(date +%%Y-%%m-%%d)".sql"' |
| === Timer === | === Timer === |
| |
| * ''01'' day of every month at ''02:10:00'' | * Monthly (3rd) ''02:10:00 AM'' |
| |
| sudo -e '/etc/systemd/system/blog-db.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'blog-db.timer' --now && sudo systemctl start 'blog-db' && sudo systemctl status 'blog-db' -l | sudo -e '/etc/systemd/system/blog-db.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'blog-db.timer' --now && sudo systemctl start 'blog-db' && sudo systemctl status 'blog-db' -l |
| |
| [Timer] | [Timer] |
| OnCalendar=*-*-01 02:10:00 | OnCalendar=*-*-03 02:10:00 |
| Persistent=true | Persistent=true |
| |
| Type=oneshot | Type=oneshot |
| |
| ExecStart='/usr/bin/git' -C '/var/www/blog' reset --hard | WorkingDirectory=/var/www/blog |
| ExecStart='/usr/bin/git' -C '/var/www/blog' gc --aggressive --prune='all' | ExecStart='/usr/bin/git' -C '/var/www/blog' gc --aggressive --prune='all' |
| ExecStart='/usr/bin/git' -C '/var/www/blog' fsck --full --strict | ExecStart='/usr/bin/git' -C '/var/www/blog' fsck --full --strict |
| ==== Timer ==== | ==== Timer ==== |
| |
| * ''01'' day of every month at ''02:30:00'' | * Monthly (3rd) ''02:30:00 AM'' |
| |
| sudo -e '/etc/systemd/system/blog-m.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'blog-m.timer' --now | sudo -e '/etc/systemd/system/blog-m.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'blog-m.timer' --now |
| |
| [Timer] | [Timer] |
| OnCalendar=*-*-01 02:30:00 | OnCalendar=*-*-03 02:30:00 |
| Persistent=true | Persistent=true |
| |