Pasāda is an ancient Pāli word that means "clearness; brightness; joy; faith; the faculty of senses."
पसाद
In this tutorial, we will install and configure the Apache http server on Ubuntu Server for both http (port 80) and https (ssl over port 443). While Drupal will run on a number of web servers, Apache is by far the most commonly used for both development and production. For more details, check out the Apache2 Web Server section of the Ubuntu Server Guide.
Install apache2:
sudo apt-get install apache2 apache2-threaded-dev
Enable the Apache mod_rewrite module, which allows URLs to be rewritten on the fly and is required to enable Clean URLs in Drupal:
sudo a2enmod rewrite
Disable the Apache modules that we won't be using:
sudo a2dismod cgi autoindex
Disable the default website and remove the default index.html file:
sudo a2dissite default && sudo rm /var/www/index.html
Now let's create a directory for the site and drop the Drupal files in place:
sudo mkdir /var/www/www.example.com
sudo chmod a+w /var/www/www.example.com
# replace "drupal-x.x.tar.gz" with the name of the current version
sudo curl http://ftp.drupal.org/files/projects/drupal-x.x.tar.gz | tar xzv -C /var/www/www.example.com --strip-components=1
sudo chmod -R o-w /var/www/www.example.com
Now let's create and configure a new site for www.example.com. Note the include of Drupal's .htaccess file, which provides a small performance boost over the traditional method of calling .htaccess by setting AllowOverride All:
echo '<VirtualHost *:80>
ServerAdmin admin@example.com
DocumentRoot /var/www/www.example.com
ServerName www.example.com
ServerAlias www.example.org www.example.net
<Directory /var/www/www.example.com>
AllowOverride None
Include /var/www/www.example.com/.htaccess
</Directory>
ErrorLog /var/log/apache2/www.example.com.error.log
LogLevel warn
CustomLog /var/log/apache2/www.example.com.access.log combined
</VirtualHost>' | sudo tee /etc/apache2/sites-available/www.example.com
Enable your new website:
sudo a2ensite www.example.com
Now let's create the accompanying secure site. Note that, for the purposes of this tutorial, we are using an automatically generated self-signed certificate. For use on a production server, you will need to generate a certificate signing request (CSR) and purchase a certificate from a certificate authority (CA). Detailed instructions are available in the Certificates section of the Ubuntu Server Guide.
First, enable the Apache ssl module, which is required for secure web traffic:
sudo a2enmod ssl
Now let's create the secure site:
echo '<IfModule mod_ssl.c>
<VirtualHost _default_:443>
ServerAdmin admin@example.com
DocumentRoot /var/www/www.example.com
<Directory /var/www/www.example.com>
AllowOverride None
Include /var/www/www.example.com/.htaccess
</Directory>
SSLEngine on
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
BrowserMatch "MSIE [2-6]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
ErrorLog /var/log/apache2/www.example.com.error.log
LogLevel warn
CustomLog /var/log/apache2/www.example.com.access.log combined
</VirtualHost>
</IfModule>' | sudo tee /etc/apache2/sites-available/www.example.com-ssl
Enable the new ssl site:
sudo a2ensite www.example.com-ssl
Finally, let's restart Apache to enable the configuration changes:
sudo /etc/init.d/apache2 restart
Find any errors? Know a better way? Please leave a comment and help improve this cookbook.