Apache から Nginx への WordPress サイト移行

旧サーバ

$ cd /var/www/html/octaviadata.com
$ sudo wp db export --allow-root
Success: Exported to 'db_octaviadata.com.sql'.
$ scp -r /var/www/html/octaviadata.com username@octaviadata.com:/tmp

新サーバ

$ sudo mysql -u root
MariaDB [(none)]> CREATE DATABASE `db_octaviadata.com`;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON `db_octaviadata.com`.* TO wpdev_admin@localhost IDENTIFIED BY 'wpdev_passwd';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> \q
Bye
$ sudo mv /tmp/octaviadata.com /var/www/html
$ cd /var/www/html/octaviadata.com
$ wp db import db_octaviadata.com.sql
Success: Imported from 'db_octaviadata.com.sql'.
$ sudo vim /etc/nginx/sites-available/octaviadata.com
    server {
	listen         80;
	listen    [::]:80;
            server_name  your_site_name.com;
            root /usr/share/nginx/html;
            index index.php index.html;
            location / {
                    try_files $uri $uri/ =404;
            }
            error_page 404 /404.html;
            error_page 500 502 503 504 /50x.html;
            location = /50x.html {
                    root /var/www/html;
            }
            location ~ \.php$ {
                    try_files $uri =404;
                    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
                    fastcgi_index index.php;
                    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                    include fastcgi_params;
            }
    }
$ cd /etc/nginx/sites-enabled/
$ sudo ln -s ../sites-available/octaviadata.com 
$ sudo nginx -t && sudo nginx -s reload