Let's connect

Transfer site from local development to the server via ssh access

What we need:

  1. Access to the server with ssh
  2. Installed on the server WP-CLI

How to install WP-CLI on the server?

  1. curl -O
  2. php wp-cli.phar --info (should output the WP-CLI version)
  3. chmod +x wp-cli.phar
  4. sudo mv wp-cli.phar /usr/local/bin/wp

Step-by-step instructions on how to quickly transfer a site. When you need to transfer to the dev version, all content and the database, or make a deployment

  1. Ssh connect to the server
  2. Go to the folder with the site cd /path/to/wp/folder
  3. We execute the command wp core download --allow-root
  4. Create DB in host panel
  5. We need to configure our wp-confing.php file for this we execute this command replacing the parameters with our data wp core config --dbname=YOUR_DATABASE_NAME --dbuser=YOUR_DATABASE_USER --dbpass=YOUR_DATABASE_PASSWORD --dbhost=if_differs_from_a_localhost --dbprefix=dbprefix
  6. We need to dump the database from the local machine and upload it to a folder on the server
  7. We import the database wp --quiet db import /path/to/file/exported-wp-sql.sql
  8. Now we need to change all URLs from local to main domain wp search-replace --all-tables
  9. We transfer all the files that are in the folder wp-content/ (if you have macOS \ Linux \ Unix you can execute the command in the terminal scp -r remoteuser@remoteserver:/remote/folder/ /path/to/wp/folder)

Now our site has been successfully transferred to the server

Post a Comment