sudo apt-get install apache2
sudo a2ensite default-ssl sudo a2enmod ssl
sudo /etc/init.d/apache2 restart
sudo mkdir /etc/apache2/ssl sudo /usr/sbin/make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/apache2/ssl/apache.crt
cd /etc/apache2/ssl sudo cp apache.crt apache.pem sudo cp apache.crt apache.key
SSLCertificateFile /etc/apache2/ssl/apache.pem SSLCertificateKeyFile /etc/apache2/ssl/apache.key
sudo chmod 600 /etc/apache2/ssl/apache.key
sudo /etc/init.d/apache2 restart
#NameVirtualHost *:80 #Listen 80
www.example.com /var/www wiki.example.com /usr/share/dokuwiki
### Mass SSL Vhosts ### RewriteEngine on # define two maps: one for fixing the URL and one which defines # the available virtual hosts with their corresponding # DocumentRoot. RewriteMap lowercase int:tolower RewriteMap vhost txt:/etc/apache2/ssl_map # 1. make sure we don't map for common locations RewriteCond %{REQUEST_URI} !^/cgi-bin/.* RewriteCond %{REQUEST_URI} !^/icons/.* # 2. make sure we have a Host header RewriteCond %{HTTP_HOST} !^$ # 3. lowercase the hostname RewriteCond ${lowercase:%{HTTP_HOST}|NONE} ^(.+)$ # # 4. lookup this hostname in vhost.map and # remember it only when it is a path # (and not "NONE" from above) RewriteCond ${vhost:%1} ^(/.*)$ # 5. finally we can map the URL to its docroot location # and remember the virtual host for logging puposes RewriteRule ^/(.*)$ %1/$1 [E=VHOST:${lowercase:%{HTTP_HOST}}]
sudo a2enmod rewrite