Translations of this page:

Configure Apache for the hosted websites

Installation mod_hash

  • create the file:
  /etc/apache2/mods-available/vhost_hash_alias.conf
  • Copy this in the vhost_hash_alias.conf file:
  # mod_vhost_hash_alias have to be enabled for each virtual host (catch-all)
  #
  HashEnable On
  
  #
  # Digest algorithm to use:
  # CRC32, ADLER32, MD5, SHA1, SHA256, or other types
  # supported by the module and libmhash
  #
  
  HashType md5
  
  #
  # The output encoding (rfc3548) of hash result
  # hexa, base16_low, base16_up, base32_low, base32_up, base64_ufs,
  #
  HashEncoding hexa
  
  #
  # Number of characters to use to build the document root
  # The hash string is truncated to this length
  #
  HashLimit 6
  
  #
  # Splitting scheme
  # Specify the size of each chunk of the digest string
  # The last count is taken until the end of string is reached
  #
  HashSplit 2 2 2
  
  #
  # The base directory used to build the document root
  # (mandatory)
  #
  HashDocumentRootPrefix /data/web
  
  #
  # A directory added to the final built root
  # (optionnal)
  #
  HashDocumentRootSuffix htdocs
  
  #
  # A list of host prefix to strip
  # eg: this handle basic web aliasing
  #   http://www.example.com/
  # will point on the same document root than
  #   http://example.com/
  #
  # (optionnal)
  #
  HashAddAliasPrefix www ftp
  • load the module on apache2
  a2enmod vhost_hash_alias

then reload apache2

  /etc/init.d/apache2 reload

Configuration of websites inside Vhffs

This is an example of virtualhost for all website insite vhffs

put this in /etc/apache2/site-available/vhffs

<VirtualHost *>
      ServerAdmin webmaster@localhost
      DocumentRoot /data/web
      HashEnable On
      <Directory /data/web/>
              Options -ExecCGI Indexes FollowSymLinks +Includes MultiViews
              IndexIgnore */.quota */.*passw* */.htaccess
              IndexOptions NameWidth=*
              AllowOverride All
              order allow,deny
              allow from all
              RewriteEngine on
      </Directory>
      ErrorLog /var/log/apache2/sites-error.log
      LogFormat "%V %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" vhffs
      CustomLog /data/logs/web/incoming/{SERVER_NAME}/vhffs.log vhffs
      # Possible values include: debug, info, notice, warn, error, crit,
      # alert, emerg.
      LogLevel warn
      ServerSignature On
      Alias /icons/ "/usr/share/apache2/icons/"
      <Directory "/usr/share/apache2/icons">
          Options Indexes MultiViews
          AllowOverride None
          Order allow,deny
          Allow from all
      </Directory>
</VirtualHost>

Now, just run

  a2ensite vhffs

Configuration of websites outside Vhffs

To avoid the URL to be hashed by the vhost hash alias module, you must insert the following code in the config:

 <VirtualHost *:80>
         [...]
         HashEnable Off
         [...]
 </VirtualHost>

Installation of suphp

Reference: http://www.suphp.org/

The configuration suphp file is

/etc/suphp/suphp.conf

Main modifications are:

docroot=/data/web

allow_file_group_writeable=true

allow_directory_group_writeable=true

check_vhost_docroot=false

min_uid=10000

min_gid=10000

In the virtual host config, insert

<IfModule mod_suphp.c>
      AddHandler x-httpd-php .php .php3 .php4 .php5 .phtml
      suPHP_AddHandler x-httpd-php
      suPHP_Engine on
</IfModule>

Then activate the module suphp:

a2enmod suphp
doc/guide/web-hosting.txt · Last modified: 2008/02/04 21:54 by misric
Recent changes RSS feed Creative Commons License Donate Driven by DokuWiki