User Tools

Site Tools


apache2_ssl_debian

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
apache2_ssl_debian [2012/08/01 04:27] memeruizapache2_ssl_debian [2021/02/01 05:55] (current) – external edit 127.0.0.1
Line 1: Line 1:
-====== apache2 + ssl + debian ======+====== apache2 + ssl + debian + virtual hosts ======
  
   * Install apache2   * Install apache2
Line 44: Line 44:
   #NameVirtualHost *:80   #NameVirtualHost *:80
   #Listen 80   #Listen 80
 +
 +  * To have virtual hosts in ssl create a map file /etc/apache2/ssl_map with the server names and their respective document roots:
 +
 +  www.example.com   /var/www
 +  wiki.example.com  /usr/share/dokuwiki
 +
 +  * To the file /etc/apache2/sites-available/default-ssl inside the VirtualHost section add the following lines:
 +
 +  ### 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}}]
 +
 +  * We need the rewrite module:
 +
 +  sudo a2enmod rewrite
 +
 +  * Restart apache2 and voila!
  
  
apache2_ssl_debian.1343795266.txt.gz · Last modified: 2021/02/01 05:55 (external edit)