In this post, we will configure the aquia/BT Drupal 8 project on the nginx webserver and Ubuntu OS without using Drupal VM. I am assuming you have already installed the following:
- Nginx
- PHP 5.6+ (though PHP 7.1+ is recommended)
- MySql
- Git
- Composer
- Drush
sudo apt-get install git composer drush
composer global require "hirak/prestissimo:^0.3"
Creating a new project with BLT
In this post, I am going to create a project named blt-drupal.com.
Run the following command to create your new project and download all dependencies (including BLT).
cd /var/www
composer create-project --no-interaction acquia/blt-project blt-drupal.com
Restart your terminal if you are using BTL for the first time, so that it can detect the BLT alias.
cd blt-drupal.com
Now make changes to your /var/www/blt-drupal.com/blt/blt.yml if needed, such as choosing an install profile. By default, BLT will install sites using the lightning profile. You can change this to any other core, contributed, or custom profile in your codebase. Make sure to download the profile if necessary, e.g., composer requires acquia/headless_lightning:~1.1.0.
profile:
name: lightning -(Change this to your own)
local:
protocol: http
hostname: 'local.${project.machine_name}.com' - (${project.machine_name}.com)
Create a database for this site, ex: blt-drupal, and add its entry in "local.settings.php" located at: /var/www/blt-drupal.com/docroot/sites/default/settings. If local.settings.php is not present, enter the below command to generate it.
blt blt:init:settings
Make the following changes to local.drush.yml:
options:
uri: 'http://local.blted8.com' - (http://blt-drupal.com)
Now it's time to install the site, simply hit
blt setup
Setting up local environment for site default.
Using drush alias @self
> source:build
> tests:behat:init:config
> source:build:composer
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Gathering patches for root package.
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating autoload files
> blt:init:git-hooks
Installing pre-commit git hook...
Installing commit-msg git hook...
> blt:init:settings
Hash salt already exists.
> source:build:frontend
> source:build:frontend-reqs
> source:build:frontend-assets
> drupal:deployment-identifier:init
Generating deployment identifier...
> drupal:install
> internal:drupal:install
[Acquia\Blt\Robo\Tasks\DrushTask] Running /var/www/blt-drupal.com/vendor/bin/drush @self site-install lightning install_configure_form.update_status_module='array(FALSE,FALSE)' install_configure_form.enable_update_status_module=NULL --sites-subdir=default --site-name='BLTed 8' --site-mail=no-reply@acquia.com --account-name='P.v+3Nw6di' --account-mail=no-reply@acquia.com --locale=en -v --ansi in /var/www/blt-drupal.com/docroot
[info] Executing: mysql --defaults-file=/tmp/drush_yfp6b9 --database=blt-drupal --host=localhost --port=3306 --silent < /tmp/drush_otdtpJ > /dev/null
You are about to DROP all tables in your 'blt-drupal' database. Do you want to continue? (yes/no) [yes]:
> yes
[info] Sites directory sites/default already exists - proceeding.
[info] Executing: mysql --defaults-file=/tmp/drush_t0tRYa --database=blt-drupal --host=localhost --port=3306 --silent < /tmp/drush_j0tr5E > /dev/null
[info] Executing: mysql --defaults-file=/tmp/drush_PKeZVc --database=blt-drupal --host=localhost --port=3306 --silent < /tmp/drush_P9xnXG
[notice] Starting Drupal installation. This takes a while.
[success] Installation complete. User name: P.v+3Nw6di User password: v4MUtB7Qju
[Acquia\Blt\Robo\Tasks\DrushTask] Done in 11:39
> drupal:config:import
[warning] BLT will NOT import configuration, /var/www/blt-drupal.com/docroot/../config/default/core.extension.yml was not found.
> drupal:toggle:modules
Executing drush pm-enable for modules defined in modules.local.enable...
[Acquia\Blt\Robo\Tasks\DrushTask] Running /var/www/blt-drupal.com/vendor/bin/drush @self pm-enable dblog devel seckit views_ui --no-interaction --ansi in /var/www/blt-drupal.com/docroot
The following module(s) will be enabled: devel, seckit
[success] Successfully enabled: devel, seckit
[Acquia\Blt\Robo\Tasks\DrushTask] Done in 19.296s
Executing drush pm-uninstall for modules defined in modules.local.uninstall...
[Acquia\Blt\Robo\Tasks\DrushTask] Running /var/www/blt-drupal.com/vendor/bin/drush @self pm-uninstall acquia_connector shield --no-interaction --ansi in /var/www/blt-drupal.com/docroot
[success] Successfully uninstalled: acquia_connector, shield
[Acquia\Blt\Robo\Tasks\DrushTask] Done in 0.937s
> blt:init:shell-alias
The BLT alias is already installed and up to date
BLT project Drupal 8 is setup. Now we need to setup a server-block in nginx for the domain http://blt-drupal.com.
cd /etc/nginx/conf.d
vi blt-drupal.conf
In blt-drupal.conf, paste the following code.
server {
listen 80;
server_name blt-drupal.com;
access_log /var/www/blt-drupal.com/access.log;
error_log /var/www/blt-drupal.com/error.log;
root /var/www/blt-drupal.com/docroot/;
index index.php;
# For Drupal >= 7 clean url
location / {
try_files $uri /index.php?$query_string;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
}
}
Add the following entry in the/etc/hosts file:
#Acquia BLT project drupal 8
127.0.1.1 blt-drupal.com www.blt-drupal.com
You are done. Now visit the site in your browser: blt-drupal.com
- Log in to post comments