How to migrate a WordPress website from an apache server of different host to digital ocean's nginx server?

Posted March 12, 2019 2.1k views
NginxApacheWordPressUbuntu 16.04

I need complete step-by-step documentation to do what i asked.
I’ll be very thankful to the person who will give me the right information.


These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
2 answers


Thanks for answering my first question there. This isn’t the shortest of processes if you’ve never migrated a website manually before. While I’ll do my best to give step by step, my perspective is of someone who manages servers regularly, and I may overlook something that my mind skips over, something I instinctively assume doesn’t need to be said. I will do my best to provide the steps though.

  • Have HostGator enable SSH (jailshell) for you.

This may require a support ticket. You just need them to run this on their server:

chsh -s /usr/local/cpanel/bin/jailshell cpanelusername
  • Connect to their server using SSH.

Your cPanel username and password are the correct credentials for this.

  • Get the database information. This should work: grep "DB_" ~/public_html/wp-config.php (That may vary if your Wordpress installation is in another folder)

Here’s an example of the details you’re looking for from that output:

define( 'DB_NAME', 'database_name_here' );
define( 'DB_USER', 'username_here' );
define( 'DB_PASSWORD', 'password_here' );
  • Dump the Wordpress database to a file. Using the details from step 3, change the appropriate values in this:

    mysqldump -u username_here -p'password_here' database_name_here > ~/database_name_here.sql
  • SSH into your new LEMP (Linux, Nginx, MySQL, PHP) droplet.

  • Create database and user. Using same values from step 3 to change the necessary values:

    create database database_name_here;
    grant all on database_name_here to username_here identified by 'password_here';
  • Sync the files over from HostGator’s server to your droplet with us:

    cd /var/www/html
    rm index.html -f
    rsync -avz .
    cd /root
    rsync -avz .

    (Change “cpanelusername” and “” to their appropriate values, as well as the databasenamehere value)

  • Import the database:

    mysql database_name_here < /root/database_name_here.sql
  • Set file ownership:

    chown -R www-data. /var/www

At this point you should be “done.” Every website is unique, especially with the wealth of plugins and configurations out there, so there may be other steps that you have to go through after this. You’ll have to take each problem as it comes and look for it’s solution individually, as one guide cannot reasonably account for all possible variables.


Okay! Thanks Jarland for this helpul information. :)