Once you've completed a website on your local computer you will most likely need to move the whole thing over to a production server so that it can be viewed at your intended domain name, something like https://www.example.com. The following is a very rough guide to how that can be done.
In order to follow this guide you will need ssh access to the production server, be using Git to manage your project, and be able to run both the scp and rsync commands from your local computer. Additionally, you must be able to access mysql from the command line on the production server (without needing to use any special ports).
In the instructions below, anywhere you see a value within curly braces {like this} you will need to replace that value with one that corresponds specifically to your own project.
From your local site
Push up your code, database, and files (w config)
From the command line on your local computer, first navigate to your project root.
-
Push all your latest commits into the Git repository
git push origin {master}
-
Push up your database using scp:
scp {path/to/local}/{sqldump.sql} {ssh_user}@{server}:.
-
Push up your files using rsync:
rsync -av files/ {ssh_user}@{server}:{/path/to/backdrop/files}
From your production server
Pull in your code, place your files & config
SSH into the production server, and complete the following steps from there.
-
Pull your code from Git
Your ssh user must have access to your Git repository.
git pull origin {master}
-
Import your database into MySQL:
Your MySQL user will need proper access to your MySQL database.
mysql -u {db_username} -p {db_name} < ~/{sqldump.sql}
-
Change permissions on files:
Your ssh user must have elevated permissions.
chgrp -R {www-data} files
chmod -R 774 files
-
Hook it all together in
settings.php
Enter your database credentials:
$database = 'mysql://{db_username}:{db_password}@localhost/{db_name}';
Enter your config file location:
$config_directories['active'] = 'files/config_{hash}/active';
$config_directories['staging'] = 'files/config_{hash}/staging';
(This post has been adapted from its original source for use in the Backdrop official documentation)