We are always looking for new ways to polish our workflows. A huge part of that flow is hosting our websites so we've looked into Microsoft Azure to see if we can use it and to what extend. So as a test scenario we've tried to host a basic Drupal 8 website on it. In the back of our minds, we also tried to make this happen without spending a lot of money.
After playing around with the vast admin panel, we've determined that there are multiple possibilities to host our Drupal 8 website. The recommended method is using an empty webapp connected to a database.
A second method is using a preconfigured webapp for Drupal 8. This method however is not scalable like the recommended one.
Last, you can also use Bitnami, but this is just a VPS that you can configure as you wish so we are not going to use this.
We only touch the recommended way in this article.
To use Drupal, we need a codebase. There are two options to retrieve the codebase, both of them need "composer". So after creating a webapp with SQL make, sure to add Composer as a extension.
After enabling composer, you can create a new Drupal 8 installation or use a composer.json from an already existing project.
If you use the package drupal-composer/drupal-project for your project, you can have troubles with composer itself. The following error can occur:
> scripts/composer/post-install.sh
'scripts' is not recognized as an internal or external command,
operable program or batch file.
Script scripts/composer/post-install.sh handling the post-install-cmd event returned with error code 1
An error has occurred during web site deployment.
Loading composer repositories with package information\r\nInstalling dependencies from lock file\r\nNothing to install or update\r\nGenerating optimized autoload files\r\n> scripts/composer/postinstall.sh\r\n'scripts' is not recognized as an internal or external command,\r\noperable program or batch file.\r\nScript scripts/composer/post-install.sh handling the post-install-cmd event returned with error code 1\r\nD:\Program Files (x86)\SiteExtensions\Kudu\61.60316.2745\bin\Scripts\starter.cmd D:\home\SiteExtensions\ComposerExtension\Hooks\deploy.cmd
The reason for this is that the used package makes some changes to the composer.json and adds an post install script. This script is written for Unix but Windows. So a change inside the composer.json file to use cmd is needed here:
"scripts":{"post-install-cmd":"/scripts/composer/post-install.sh"},## Change to ##"scripts":{"post-install-cmd":"bash ./scripts/composer/post-install.cmd"},
After changing the script, you need to (rewrite the original script to commands that Windows can read.
Now we can safely execute composer install and/or update.
Next problem can occur, especially on the package used in this example, when you try visiting the frontend now. You can see one of two errors:
You do not have permission to view this directory or page.
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
Both messages are because the index.php is not inside the root of the project. Because we are using the package drupal-composer/drupal-project, our index.php is inside the web/folder.
To make things work, we need to access the Azure portal and navigate to the "Application settings" of our webapp. On the bottom you find "Virtual applications and directories" with one entry filled in:
After saving this config and refreshing your website, you should see the Drupal installation process.
Now you are ready to start developing your Drupal site on Microsoft Azure! pal installation process.
SHARE
This website uses cookies and comparable tags or scripts, called "cookies", to improve your phpro.be experience.
Want to learn more about these cookies? Click "Settings".
Cookie policy
To improve your PHPro.be experience we use different types of cookies: functional, analytical and marketing cookies. The cookies are small files that store session related data for this website. Some are necessary for a good experience on PHPro.be while help us analyse and improve our website based on usage data.
In addition to our functional cookies, analytical cookes allow us obtain information on the usage of our website. This is completely anonymous and allows us to improve our website.
Marketing cookies help us optimise and improve your browsing experience and allows us to perform relevant and more personal marketing activities. This will enable us to show you relevant ads, on our website and on other websites.