How to install Drupal 8 to live server

  1. Create database in live server
  2. Inport database
  3. Copy file to directory

setting.php > Trust pattern

Trust pattern - for single domain
$settings['trusted_host_patterns'] = array(
  '^www\.example\.com$',
  '^example\.com$',
  );

Trust pattern - for multisite domain

$settings['trusted_host_patterns'] = array(
  '^example\.com$',
  '^.+\.example\.com$',
  '^example\.org',
  '^.+\.example\.org',
);

setting.php > Setting public file;

$settings['file_public_path'] = 'sites/default/files';


setting.php > Setting private file;

$settings['file_private_path'] = 'sites/default/files/private';


setting.php > Database

$databases['default']['default'] = array(
    'database' => 'databasename',
    'username' => 'sqlusername',
    'password' => 'sqlpassword'
    'prefix' => '',
    'host' => 'localhost',
    'port' => '3306',
     'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
     'driver' => 'mysql',
   );

CHMOD "default" and "setting.php" directory - so that we can make it writable to setting

  • default: 755
  • setting.php: 644

After that change back to the original permission:

  • default: 555
  • setting.php: 544

change file temporary directory to: tmp

configuration > media > file system


Edit image link if need..


Reading:

https://www.ostraining.com/blog/drupal/change-the-database-connection/

Installing the Site on a Production Server with Composer