Copy a site by hand
This page is one of the ways to move a site to Netkeel. Use it for Custom PHP, Laravel, Joomla and Drupal sites, which have no import yet. It also works for WordPress, but the WordPress import does the database settings and the address change for you.
First do the steps under Before you move, so the server and the application exist.
1. Connect with SFTP
Section titled “1. Connect with SFTP”SFTP is a way to copy files to a server. On Netkeel it uses SSH keys, not passwords.
- Create an SSH key if you don’t have one.
- Add it under the application’s SSH / SFTP.
- Connect with FileZilla, Cyberduck or WinSCP. See SFTP and SSH access.
2. Upload the files
Section titled “2. Upload the files”Download the site’s files from the old host, then upload them into the application’s htdocs folder:
| Type | What to upload |
|---|---|
| Custom PHP | The files that were in the old web root. index.php is served first. |
| Laravel | The whole project. Its public folder is served. |
| Joomla | The files that were in the old web root. |
| Drupal | The whole Composer project, with web as the folder that is served. A Drupal site without that layout has to be converted to it first. |
3. Keep Netkeel’s database settings
Section titled “3. Keep Netkeel’s database settings”The old site’s configuration points to the old host’s database. Netkeel’s application already has its own database, and its login is on the card at the top of Database › Databases. Make the uploaded site use that login. Open your type:
Custom PHP
Replace the old database name, user, password and host in your configuration with the values from Database › Databases, or read them with getenv(). See Connect to the database.
Laravel
In the project’s .env, set:
DB_CONNECTION=mysqlDB_HOST=localhostDB_SOCKET=/run/mysqld/mysqld.sockDB_DATABASE,DB_USERNAMEandDB_PASSWORDfrom Database › Databases
Keep the old APP_KEY: data encrypted with it can’t be read with a new one.
Joomla
- Before you upload, download Netkeel’s
configuration.phpfromhtdocs. - After you upload the old site, copy the
$host,$user,$password,$db,$tmp_pathand$log_pathlines from Netkeel’s file into the uploadedconfiguration.php. - Keep the old
$dbprefix: it must match the tables in your database dump.
Drupal
Don’t upload over web/sites/default/settings.php or settings.netkeel.php. Netkeel’s settings.php ends with a line that includes settings.netkeel.php, which holds the database login.
If the old settings.php has settings of your own, copy them into Netkeel’s file after that line, but leave out the old $databases block.
WordPress
Don’t upload over wp-config.php. If the old one has constants of your own, copy them into Netkeel’s file, but keep its DB_NAME, DB_USER, DB_PASSWORD and DB_HOST. Set $table_prefix to the old one, so it matches the tables in your dump.
4. Import the database
Section titled “4. Import the database”Export the old site’s database as a .sql file (in phpMyAdmin: Export, Quick, SQL). Then load it in one of three ways:
| Way | For | Limit |
|---|---|---|
| Import on the Databases page | The main database of MySQL (MariaDB) and MySQL 8 applications | A .sql file up to 10 GB |
| Adminer | Smaller dumps, .sql or .sql.gz |
The application’s Upload max filesize: 128 MB by default, up to 1 GB under Settings › PHP |
| SSH | Any size | None |
With Import
Section titled “With Import”Go to Database › Databases and click Import on the main database’s card. The import replaces the database’s whole contents, after a safety backup. See Import or export SQL files.
With Adminer or over SSH
Section titled “With Adminer or over SSH”Import with Adminer
- Go to Database › Databases and click Open Adminer. Adminer opens in a new tab, already signed in to the application’s database.
- To delete the installed tables first, tick the box at the top of the table list to select them all, click Drop and confirm.
- Click Import, choose your
.sqlor.sql.gzfile under File upload, and click Execute.
For a larger file, raise Upload max filesize and Post max size under Settings › PHP (up to 1 GB), or use SSH.
Import over SSH
-
Upload the dump with SFTP, for example into the application’s
homefolder. -
Turn on SSH access under SSH / SFTP and connect with the
sshcommand the page shows. -
Run, with the database user and name from Database › Databases:
Terminal window mysql -u DATABASE_USER -p DATABASE_NAME < ~/dump.sqlType the database password when asked. For a
.sql.gzfile, rungunzip < ~/dump.sql.gz | mysql -u DATABASE_USER -p DATABASE_NAME. -
Delete the dump file when the import is done.
WordPress: change the address
Section titled “WordPress: change the address”The database still holds the old site’s address. Run a search and replace from your domain to the application’s preview address, so the site works there before you take it live.
5. Add your cron jobs
Section titled “5. Add your cron jobs”Add the old host’s cron jobs under Settings › Cron jobs. See Scheduled tasks. Laravel’s scheduler, and Joomla’s and Drupal’s own scheduled tasks, already run for you.
Next step
Section titled “Next step”Check the site on its preview address, then switch your domain.