Comments on How to Install Drupal 8 with Apache, MySQL and SSL on Ubuntu 15.10
In this tutorial, I will show you how to install Drupal 8 on Ubuntu 15.10 with Apache as web server, MySQL as database backend and how to secure the website with SSL. Drupal is a open-source content management system based on PHP and distributed under the GNU General Public License. Drupal is a scalable and open platform for web content management, it's community provides more than 31,000 modules to extend the core functions and Drupal is used by at least 2.1% of all website on the internet.
23 Comment(s)
Comments
Thank you so much for this howto, I followed all the steps until I got to the step 4, where it asks to create the vim drupal.conf, I did the copy step but right on the bottom it says "Replace the domain name www.mydrupal.co with the domain name of your Drupal website", my machine is just going to be a local server using localhost or 127.0.1.1, I changed www.mydrupal.co with localhost but when I go to the web browser and type localhost/drupal8 it says "Not Found The requested URL /drupal8 was not found on this server" I have already downloaded likde it says in step 5 and I finished the steps there.
I am experiencing problems with getting Drupal 8 installed and configured. Initially I downloaded LAMP on a new Ubuntu 15.10 install that only had 'gparted' and 'xrdp' installed. I followed instruction to install Drupal on an Ubuntu 14.04 Server that installed Drupal 7.32 but doing a 'wget' of Drupal 8.0.1 prior to Christmas and had no success and ran out of time.
I believe I cleaned up the LAMP items and then reinstalled using these instruction. I am also using my private IP 192.168.0.159 and a hostname without a domain for configuring the Apache Virtualhost (Step 4). In Step 5 "Install and Configure Drupal 8" ('drush' downloaded 8.0.2), it complained about the HTTPS. But was able to perform the configure part using HTTP. The last screen shot comes up. But I am unable to do anything beyond this and it continues to complain about HTTPS.
The only noticeable error was in Step 1 with the "apache2ctl -M | egrep 'ssl|rewite'" which also complained about the hostname and that it would use the loopback IP 127.0.0.1. I looked through the lengthy "<?php phpinfo();" output and saw nothing obvious. The Apache Environment had HTTP.HOST set to 192.168.0.195.
--Mark
Just after I select the installation profile, I get an error about clean URLs.
I would suspect that this was not what is intended.
I agree, the tutorial should include settings for clean urls on the server because that does not work unfortunately, which makes the installed Drupal8 almost unusable.
I had an issue in the first step at line apache2ctl -M | egrep 'ssl|rewrite'.
Error message: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
The Ubuntu 15.10 version is fresh (18th February 2016) and it is a desktop 64 bit instance.
Fixing this problem is, however, quite easy. Apache wants you to define a ServerName. So let’s add it by first opening terminal and editing the httpd.conf file: sudo nano /etc/apache2/apache2.conf Go to the very bottom of that file and add this line: ServerName localhost
Thank you for the fix for the author of the following article:
https://thomas.vanhoutte.be/miniblog/fix-apache-error-ah00558/
After following this tutorial I got stuck at opening Drupal in the browser. Like others here, I'm running this on a local server and am unable to navigate to the Drupal installation in the browser. I've tried replacing "www.mydrupal.co" in the config file with various things such as the server's IP, localhost... nothing works.
Any update to this tutorial? Thanks.
Replace www.mydrupal.co with an arbitrary domain name (or keep as www.mydrupal.co) and then edit the hosts file on the client machine that you will be accessing Drupal from with an entry which redirects the arbitrary domain name to the server IP (I think localhost could even work), on my LAN this entry got it to work from my Mac laptop:
192.168.0.2 www.mydrupal.co
Alternatively you can also edit this file
/etc/apache2/sites-available/000-default.conf
remove:
DocumentRoot /var/www/html
and add instead, then you can access site in browser via ipaddress/drupal:
DocumentRoot /var/www
mv drupal-8.0.1/* . doesn't move the hidden files in the folder. To move everything, use mv drupal-8.0.1/{.,}* .
Thank you for great tutorial!!!
For Drupal 8.0.5
================
I added some setting for Step 5:
1. Set password for drupaluser
SET PASSWORD FOR drupaluser@localhost = PASSWORD('xyz');
2. Install a php5-mysql module in order to select a MySQL database in the 'Database configuration' page.
sudo apt-get install php5-mysql
After this you need restart an apache.
sudo service apache2 restart
I can access the home page (http://mydrupal.co), but when I clicked any further links (e.g. http://mydrupal.co/admin/structure),
it shows error:
"Not Found
The requested URL /admin/structure was not found on this server."
This happened because an apache not found the .htaccess file in the /var/www/drupal directory. The mv command doesn't copy the hidden files (i.e. .htaccess file). You should copy .htaccess file before deleting the drupal-8.0.x directory.
Below a new sequence which doing this:
mv drupal-8.0.5/* .
cp drupal-8.0.5/.htaccess .htaccess
rm -rf drupal-8.0.5/
Yes, you are right, and there are other hidden files. So, the extra step should be:
mv drupal-8.*/* .
This worked perfectly for me on Ubuntu 14.04, just wanted to add that you will also need to install postfix in order for the app to send emails.
Took way too many tests because noone came back to give the solution to the clean urls problem. This worked for me ...
Update this Directory section in /etc/apache2/apache2.conf to look like this:
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^ index.php [L]
Be sure to restart apache:
# apachectl configtest
# systemctl restart apache2
Thanks so much for that 'chewbacca', it worked for me.
Thank you for this tutorial. I followed the steps and successfully installed www.mysite1.com. But when I am trying to setup www.mysite2.com then mysite1 has stopped working and getting configuration from mysite2. Any idea why it is happening that site1 is getting configuration from site 2. Or is there something else I need to take care of for installation more than 1 sites in a single server?
Thanks in advance.
drush dl drupal-8 command not working
it gives error everytime
<pre>mkg drupal # drush dl drupal-8
PHP Fatal error: Uncaught Error: Call to undefined function Drush\UpdateService\simplexml_load_file() in phar:///usr/bin/drush/lib/Drush/UpdateService/Project.php:74
Stack trace:
#0 phar:///usr/bin/drush/lib/Drush/UpdateService/ReleaseInfo.php(64): Drush\UpdateService\Project::getInstance(Array, 86400)
#1 phar:///usr/bin/drush/lib/Drush/UpdateService/ReleaseInfo.php(122): Drush\UpdateService\ReleaseInfo->get(Array)
#2 phar:///usr/bin/drush/commands/pm/download.pm.inc(111): Drush\UpdateService\ReleaseInfo->selectReleaseBasedOnStrategy(Array, '', 'auto', false, NULL)
#3 phar:///usr/bin/drush/includes/command.inc(373): drush_pm_download('drupal-8')
#4 phar:///usr/bin/drush/includes/command.inc(224): _drush_invoke_hooks(Array, Array)
#5 phar:///usr/bin/drush/includes/command.inc(192): drush_command('drupal-8')
#6 phar:///usr/bin/drush/lib/Drush/Boot/BaseBoot.php(67): drush_dispatch(Array)
#7 phar:///usr/bin/drush/includes/preflight.inc(66): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#8 phar:///usr/bin/drush/includes/startup.in in phar:///usr/bin/drush/lib/Drush/UpdateService/Project.php on line 74
Drush command terminated abnormally due to an unrecoverable error. [error]
Error: Uncaught Error: Call to undefined function
Drush\UpdateService\simplexml_load_file() in
phar:///usr/bin/drush/lib/Drush/UpdateService/Project.php:74
Stack trace:
#0 phar:///usr/bin/drush/lib/Drush/UpdateService/ReleaseInfo.php(64):
Drush\UpdateService\Project::getInstance(Array, 86400)
#1 phar:///usr/bin/drush/lib/Drush/UpdateService/ReleaseInfo.php(122):
Drush\UpdateService\ReleaseInfo->get(Array)
#2 phar:///usr/bin/drush/commands/pm/download.pm.inc(111):
Drush\UpdateService\ReleaseInfo->selectReleaseBasedOnStrategy(Array, '',
'auto', false, NULL)
#3 phar:///usr/bin/drush/includes/command.inc(373):
drush_pm_download('drupal-8')
#4 phar:///usr/bin/drush/includes/command.inc(224):
_drush_invoke_hooks(Array, Array)
#5 phar:///usr/bin/drush/includes/command.inc(192):
drush_command('drupal-8')
#6 phar:///usr/bin/drush/lib/Drush/Boot/BaseBoot.php(67):
drush_dispatch(Array)
#7 phar:///usr/bin/drush/includes/preflight.inc(66):
Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#8 phar:///usr/bin/drush/includes/startup.in in
phar:///usr/bin/drush/lib/Drush/UpdateService/Project.php, line 74
</pre>
Thank you Chewbacca !
This tutorial needs some revising. Drupal 8 is alive, active and being updated. Sadly, the documentation is still lagging behind. Ubuntu is on version 16.04.1 LTS and the standard in php now is version 7 (not 5).
Agreed, updates would be awesome. I can't get past the apache2 configuration. I have a TLD pointed at a box on my home network we'll call 'box.mydomain.com' I have done everything one would expect to pull the initial drupal configuration up in a web browser, but it continues to want to open the /var/www/html structure rather than the /var/www/drupal like it should. Here's my /etc/apache2/sites-available/drupal.conf:
--------------------------
<VirtualHost *:80>
ServerName box.mydomain.com
DocumentRoot /var/www/drupal
# Redirect http to https
RedirectMatch 301 (.*) https://box.mydomain.com$1
</VirtualHost>
<VirtualHost _default_:443>
# Server Info
ServerName box.mydomain.com
ServerAlias box.mydomain.com
ServerAdmin webmaster@localhost
# Web root
DocumentRoot /var/www/drupal
# Log configuration
ErrorLog ${APACHE_LOG_DIR}/drupal-error.log
CustomLog ${APACHE_LOG_DIR}/drupal-access.log combined
# Enable/Disable SSL for this virtual host.
SSLEngine on
# Self signed SSL Certificate file
SSLCertificateFile /etc/apache2/ssl/drupalssl.crt
SSLCertificateKeyFile /etc/apache2/ssl/drupalssl.key
<Directory "/var/www/drupal">
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory /usr/lib/cgi-bin>
SSLOptions +StdEnvVars
</Directory>
BrowserMatch "MSIE [2-6]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
# MSIE 7 and newer should be able to use keepalive
BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
</VirtualHost>
-----------------------
Ideally I'd like to point drupal.mydomain.com to this machine so that box.mydomain.com could continue using the /var/www/html directory. Perhaps my understanding of virtual hosts is fundamentally flawed? Maybe someone could explain this conf file a little better to me? TIA
After hours of messing with the self signed certificate (which I had no problem generating as per instruction), I used "Let's Encrypt" and certbot instead. You can spend hours messing around trying to get Chrome or Firefox to not give you the "Not Secure" error in the browser -or- this solution will just take care of it. I hope this saves someone else literally hours of research and head to desk time.
Procedure on centos 7 with little modifications, work.
Thks guy
just greet!! Thank you so much!