Apache

    VirtualHost

    <VirtualHost *:80>
      ServerAdmin webmaster@society-lbl.com
      DocumentRoot /home/gs-lbl/www/
    </VirtualHost>
    

    Notice: minimal example.

    <VirtualHost *:80>
      ServerAdmin webmaster@society-lbl.com
      ServerName gs-lbl.society-lbl.com
    
      DocumentRoot /home/gs-lbl/www/
    
      <Directory /home/gs-lbl/www/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
      </Directory>
    
     <Directory /home/gs-lbl/www/private/>
        Order allow,deny
        deny from all
      </Directory>
    
      # We specify the log files
      ErrorLog /home/gs-lbl/logs/apache2/error_gs-lbl.log
      CustomLog /home/gs-lbl/logs/apache2/access_gs-lbl.log combined
      LogLevel warn
    </VirtualHost>
    

    Notice:

    - "Options Indexes" is equivalent of "Options +indexes"
    - It is possible to use rotatelog `ErrorLog "|usr/sbin/rotatelogs /home/gs-lbl/logs/apache2/error_gs-lbl.%Y-%m-%d-%H_%M_%S.log 5M"`
    - **Note**: Please check where is rotatelogs with `whereis` command.
    

    Directory

    List files

    Use ''apaxy''((https://github.com/AdamWhitcroft/Apaxy.git)) project very beautiful.

    Authentication

    Htpasswd/Htaccess

    .htaccess

    AuthUserFile /absolute_path/.htpasswd
    AuthType Basic
    AuthName "Private Access"
    Require valid-user
    

    This command permit to make htpasswd file: htpasswd -c .htpasswd username password

    Note:

    - remove -c option if htpasswd already exist((could erase the current htpasswd file if you don't remove))
    - password is optional at first, it could be ask after
    

    Certificates

    # require a client certificate which has to be directly
    # signed by our CA certificate in ca.crt
    SSLVerifyClient require
    SSLVerifyDepth 1
    SSLCACertificateFile "conf/ssl.crt/ca.crt"
    

    Reference

    Modules

    Alias

    Enable the module: a2enmod alias

    After that you could access to specific directory when you specify for example (/etc/apache2/conf.d/rtorrent.conf):

    Alias /rutorrent /home/rtorrent/public_html
    

    When you type : http://ip/rutorrent it will go on /home/rtorrent/public_html

    SSL

    To enable this module: a2enmod ssl

    If you would like to access to https://192.168.2.2/ make sure default-ssl is linked to site-enabled: a2ensite default-ssl

    Note: If you don't do that you could have this error: [Thu Sep 19 16:21:14 2013] [error] [client 192.168.2.2] Invalid method in request \x16\x03\x01{- apache2/error.log}

    If you would like to force ssl access on directory:

    /etc/apache2/conf.d/rtorrent.conf

    <Directory /home/rtorrent/public_html>
            SSLOptions +StrictRequire
            SSLRequireSSL
    </Directory>
    

    PHP

    This directive permits to retrieve a maximum of logs about php:

    php_admin_value log_errors true
    php_admin_value error_log "/home/fws/logs/fws_php_details.log"
    php_admin_value display_errors "/home/fws/logs/fws_php_errors.log"
    php_admin_value error_reporting 32767
    

    Note:

    - You could just show error on stdout if you do that: `php_admin_value display_errors "On"`{apache}
    - You could use php_value instead of php_admin_value. php_value permit to modify the value with htaccess.
    

    Trick

    Redirect with rewrite

    /etc/apache2/sites-available/www.frenchwinesociety.org

    <VirtualHost *:80>
            DocumentRoot /home/fws_joomla3/public_html/
    
            ServerAdmin support@society-lbl.com
    	ServerName www.frenchwinesociety.org
            ServerAlias joomla3_template.dev.frenchwinesociety.org joomla3.dev.frenchwinesociety.org
    
            AssignUserId fws_joomla3 fws_joomla3
    
    	<IfModule mod_rewrite.c>
    		RewriteEngine on
    		RewriteLog /home/fws_joomla3/logs/https_rewrite.log
    		RewriteLogLevel 1
    		RewriteCond %{SERVER_PORT} !^443$
    		RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [L,R]
    	</IfModule>
    
            CustomLog "|usr/sbin/rotatelogs /home/fws_joomla3/logs/apache2-access.%Y-%m-%d-%H_%M_%S.log 5M" combined
            ErrorLog  "|usr/sbin/rotatelogs /home/fws_joomla3/logs/apache2-error.%Y-%m-%d-%H_%M_%S.log 5M"
    </VirtualHost>
    

    Note: Please ensure you've a virtualhost which running on port 443