Setup drupal 8 using aquia/blt on nginx & Ubuntu
Here we are going to setup aquia/blt drupal 8 project on Nginx webserver, and Ubuntu OS withoud using Drupal VM. I assume you have already installed 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"
cd /var/www
Run the following command to create your new project and download all dependencies (including BLT).
composer create-project --no-interaction acquia/blt-project blt-drupal.com
Restart your terminal if you are using BTL first time, so that it can detect BLT alias.
cd blt-drupal.com
Now make changes in your /var/www/blt-drupal.com/blt/blt.yml if needed, such as to choose 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 require 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 not found, enter this command to generate it.
blt blt:init:settings
Now, make following changes in local.drush.yml:
options:
uri: 'http://local.blted8.com' - (http://blt-drupal.com)
Now its time to install Drupal, 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 server-block in nginx for domain "http://blt-drupal.com" and also make the entry in hosts file.
cd /etc/nginx/conf.d
vi blt-drupal.conf
and add the following code in that file.
server {
listen 80;
server_name www.blt-drupal.com;
rewrite ^/(.*) http://blt-drupal.com/$1 permanent;
}
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 following entry in /etc/hosts file
#Acquia BLT project drupal 8
127.0.1.1 blt-drupal.com www.blt-drupal.com
Comments
Post a Comment
There is comment posted on your blog, chandu7929@blogpost.com