Step 2: Configure Drupal 8 standard install

An excellent resource for this step can be found here: https://www.rosehosting.com/blog/how-to-install-lemp-and-run-drupal-on-ubuntu-16-04/

ssh root@droplet1ip

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"

php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"

php composer-setup.php

php -r "unlink('composer-setup.php');" # Install composer https://getcomposer.org/download/ php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"php composer-setup.phpphp -r "unlink('composer-setup.php');" # Make it accessible globally

mv composer.phar /usr/local/bin/composer

cd /var/www

composer create-project drupal-composer/drupal-project:8.x-dev medium-demo-drupal --stability dev --no-interaction

cd medium-demo-drupal

mkdir config

mkdir config/sync

curl

mv drupal.phar /usr/local/bin/drupal

chmod +x /usr/local/bin/drupal # Install Drupalcd /var/wwwcomposer create-project drupal-composer/drupal-project:8.x-dev medium-demo-drupal --stability dev --no-interactioncd medium-demo-drupalmkdir configmkdir config/synccurl https://drupalconsole.com/installer -L -o drupal.pharmv drupal.phar /usr/local/bin/drupalchmod +x /usr/local/bin/drupal # Create blank MySQL database

mysql -u root -pdemo2018

create database drupal;’

exit

Now we have a Drupal 8 site installed in on our webserver. We now need to configure the server so that we can access our new website. To follow this stage you will need a purchased domain and access to it’s DNS settings. We will use subdomains of the blockbinder domain for this demo.

In your DNS settings you will need to point a subdomain or domain at the public IP of each of your nodes. Then ->

sudo nano /etc/hosts # Add line in hosts file

127.0.0.1 medium-demo-drupal.blockbinder.com

# write changes and exit, ctr o, ent ** # Create free SSL cert ** sudo nginx -t

sudo service nginx restart

sudo certbot --nginx -d medium-demo-drupal.blockbinder.com rm /etc/nginx/sites-available/default

sudo nano /etc/nginx/sites-available/default # Copy below code

server {

server_name medium-demo-drupal.blockbinder.com;

root /var/www/medium-demo-drupal/web; ## <-- Your only path reference. error_log /var/log/nginx/drupal.log; location = /favicon.ico {

log_not_found off;

access_log off;

} location = /robots.txt {

allow all;

log_not_found off;

access_log off;

} # Very rarely should these ever be accessed outside of your lan

location ~* \.(txt|log)$ {

allow 192.168.0.0/16;

deny all;

} location ~ \..*/.*\.php$ {

return 403;

} location ~ ^/sites/.*/private/ {

return 403;

} # Block access to "hidden" files and directories whose names begin with a

# period. This includes directories used by version control systems such

# as Subversion or Git to store control files.

location ~ (^|/)\. {

return 403;

}

# try_files $uri

try_files $uri /index.php?$query_string; # For Drupal >= 7

} location / {# try_files $uri @rewrite ; # For Drupal <= 6try_files $uri /index.php?$query_string; # For Drupal >= 7

rewrite ^/(.*)$ /index.php?q=$1;

} location @rewrite rewrite ^/(.*)$ /index.php?q=$1; # In Drupal 8, we must also match new paths where the '.php' appears in the middle,

# such as update.php/selection. The rule we use is strict, and only allows this pattern

# with the update.php front controller. This allows legacy path aliases in the form of

# blog/index.php/legacy-path to continue to route to Drupal nodes. If you do not have

# any paths like that, then you might prefer to use a laxer rule, such as:

# location ~ \.php(/|$) {

# The laxer rule will continue to work if Drupal uses this new URL pattern with front

# controllers other than update.php in a future release.

location ~ '\.php$|^/update.php' {

fastcgi_split_path_info ^(.+?\.php)(|/.*)$;

include fastcgi_params;

include snippets/fastcgi-php.conf;

fastcgi_param SCRIPT_FILENAME $request_filename;

fastcgi_intercept_errors on;

fastcgi_pass unix:/run/php/php7.0-fpm.sock;

}

# location ~ ^/sites/.*/files/imagecache/ { # For Drupal <= 6

location ~ ^/sites/.*/files/styles/ { # For Drpal >= 7

try_files $uri

} # Fighting with Styles? This little gem is amazing.# location ~ ^/sites/.*/files/imagecache/ { # For Drupal <= 6location ~ ^/sites/.*/files/styles/ { # For Drpal >= 7try_files $uri @rewrite location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {

expires max;

log_not_found off;

} listen [::]:443 ssl ipv6only=on; # managed by Certbot

listen 443 ssl; # managed by Certbot

ssl_certificate /etc/letsencrypt/live/medium-demo-drupal.blockbinder.com/fullchain.pem; # managed by Certbot

ssl_certificate_key /etc/letsencrypt/live/medium-demo-drupal.blockbinder.com/privkey.pem; # managed by Certbot

include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot

ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}

if ($host = medium-demo-drupal.blockbinder.com) {

return 301

} # managed by Certbot server {if ($host = medium-demo-drupal.blockbinder.com) {return 301 https://$host$request_uri } # managed by Certbot server_name medium-demo-drupal.blockbinder.com; listen 80;

listen [::]:80;

return 404; # managed by Certbot

} # write changes and exit, ctr o, ent sudo nginx -t

sudo service nginx restart # all going well, we can now load our new Drupal website https://medium-demo-drupal.blockbinder.com # Finish the installer, and let's get installing Angular!