Code Snippet

Just another Code Snippet site

[Apache] Config examples

Delcare a new virtual host (host1 for example) :

<VirtualHost _default_:80>
        # Root Folder
        DocumentRoot /var/www

        # Protect parent folder
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        # Allow redirection (htaccess) for current colder
        <Directory /var/www/host1>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride all
                Order allow,deny
                allow from all
        </Directory>

        # Protect script folders
        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        # ##############################################################
        #             LOGGING 
        # ##############################################################
        ErrorLog ${APACHE_LOG_DIR}/host1_error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn
        CustomLog ${APACHE_LOG_DIR}/host1_access.log combined

        # ##############################################################
        #             IE special functions
        # ##############################################################
        BrowserMatch "MSIE [2-6]" \
                nokeepalive ssl-unclean-shutdown \
                downgrade-1.0 force-response-1.0
        # MSIE 7 and newer should be able to use keepalive
        BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown

        # ##############################################################
        #             Proxy configuration
        # ##############################################################
        ProxyRequests     Off
        ProxyPreserveHost On

        # ##############################################################
        #             Alias configuration
        # ##############################################################
        Alias /<context_root> /var/www/host1

</VirtualHost>

						

,


Comments are currently closed.