Drupal 7 引越しメモ

Nid: 1193

1 . バックアップと転送

old.octaviadata.com $ cd /var/www/html/octaviadata.com
old.octaviadata.com $ drush archive dump
old.octaviadata.com $ scp /home/claire/drush-backups/archive-dump/20181218101030/db_octaviadata.com.20181218_101033.tar.gz octaviadata.com:/tmp

2 . DNS更新

https://www.onamae.com

https://www.namecheap.com/

3 . リストア

$ sudo drush archive-restore /tmp/db.octaviadata.com.20181219_091705.tar.gz --destination=./octaviadata.com --db-url=mysql://dp_db_admin:dp_db_password@localhost/db_octaviadata.com --db-su=root
$ sudo vi sites/default/settings.php
$ sudo -u www-data drush -y pm-update &&  sudo drush l10n-update
$ sudo chown -R www-data:www-data .;sudo find . -type f -exec chmod 444 '{}' \; && sudo find . -type d -exec chmod 555 '{}' \; && sudo chmod a+w sites/default/files && sudo chmod 444 sites/default/settings.php && find sites/default/files -type d -print0 | xargs -0 sudo chmod 755

4 . Nginx設定

$ sudo vi /etc/nginx/sites-available/octaviadata.com
$ sudo ln -s /etc/nginx/sites-available/octaviadata.com /etc/nginx/sites-enabled/
$ sudo nginx -t && sudo nginx -s reload

5 . http アクセス確認

http://octaviadata.comadmin

6 . 証明書取得 certbot

$ sudo certbot --nginx certonly --agree-tos -w /var/lib/letsencrypt/ --expand -d octaviadata.com,www.octaviadata.com

4 . Nginx設定

$ sudo vi /etc/nginx/sites-available/octaviadata.com
$ sudo nginx -t && sudo nginx -s reload

8 . https アクセス確認

http://octaviadata.comadmin/reports/status
http://octaviadata.com/update.php
http://octaviadata.com/admin/config/people/accounts

9 . certbot dry-run

$ sudo certbot --nginx renew --dry-run

10 . マルウェアチェック

$ sudo find /var/www/html -name "\.*.ico";sudo find /var/www/html -mindepth 3 -name index.php | grep -v 'htmlpurifier/tests/index.php' | grep -v 'wp-admin\|wp-content';sudo find /var/www/html -type f | egrep './[a-z]{8}\.php' | grep -v 'template.php\|settings.php\|autoload.php\|jsonpath.php\|generate.php\|advanced.php\|ckeditor.php\|entities.php\|jmespath.php\|comments.php\|category.php\|bookmark.php\|revision.php\|taxonomy.php\|timeline.php\|activity.php\|debugger.php\|contacts.php\|facebook.php\|freedoms.php\|gzdecode.php\|services.php\|archives.php'

11 . バックアップ

$ cd /var/www/html/octaviadata.com
$ sudo drush archive-dump --destination=/var/www/html/db_${PWD##*/}.`date +%Y%m%d_%H%M%S`.tar.gz
Archive saved to /var/www/html/db_octaviadata.com.20181219_120732.tar.gz