Apache configuration for shared instances

Discussion corner for Developers of Serendipity.
Post Reply

Does it help you?

OMG! You are my god!
0
No votes
OMG! You are my god!
0
No votes
Thanks, that's what I looked for!
1
50%
Thanks, that's what I looked for!
1
50%
I guess it's great, but I don't understand it.
0
No votes
I guess it's great, but I don't understand it.
0
No votes
It sucks! ;)
0
No votes
It sucks! ;)
0
No votes
 
Total votes: 2

twobee
Regular
Posts: 19
Joined: Thu May 18, 2006 8:02 pm
Location: Berlin
Contact:

Apache configuration for shared instances

Post by twobee »

IMPORTANT: This configuration example was ONLY tested with Apache 2.0, I will NOT give free support Apache 1.3, neither Apache 2.2.

Requirements:

* Apache 2.0.5x (2.0.55 is ok, but better upgrade to 2.0.58)
* Server access
* the possibility to modify your httpd.conf and/or to add a vhost configuration file.
* wildcard DNS entry for at least i.e. "*.weblog.domain.com"

Features:
* Wildcard configuration for <name>.weblog.domain.com
* Settings apply to every vhost.
* Easy maintenance

Just place Serendipity in "/var/www/domain.com/weblog/s9y".
The users weblogs are placed in "/var/www/domain.com/weblog/weblogs/<username>",
you can the change the path if you wish to.

At the moment I am also working on a script which are is 'spawning' shared directories
for you. The script will be bound to a configuration like this.

Code: Select all

<VirtualHost *:80>
        ServerName weblog.domain.com
        ServerAlias *.weblog.domain.com

        DocumentRoot /var/www/domain.com/weblog/htdocs
        DirectoryIndex index.html index.php

        <Directory /var/www/domain.com/weblog/htdocs>
        AllowOverride None
        #AllowOverride AuthConfig FileInfo Indexes Limit
        Options -Indexes SymLinksIfOwnerMatch -Includes -MultiViews
        </Directory>


        CustomLog /var/logs/apache2/access-com_domain_weblog.log combined
        ErrorLog /var/logs/apache2/error-com_domain_weblog.log

        # PHP Restrictions
        php_admin_flag safemode On # optional
        php_admin_value open_basedir ".:/var/www/domain.com/weblog/"
        php_admin_value include_path ".:/var/www/domain.com/weblog/"
        #php_admin_value upload_tmp_dir "/var/www/domain.com/weblog/php_tmp_upload"
        php_admin_value session.save_path "/var/www/domain.com/weblog/php_tmp_session"

        php_admin_value safe_mode_include_dir ".:/var/www/domain.com/weblog/"
        php_admin_value safe_mode_exec_dir ".:/var/www/domain.com/weblog/"

        php_admin_value error_log "/var/logs/apache2/php_error-com_domain_weblog.log"

        <Directory /var/www/domain.com/weblog/weblogs/*>
        DirectoryIndex index.html index.php

        AllowOverride AuthConfig FileInfo Indexes Limit
        Options -Indexes SymLinksIfOwnerMatch -Includes -MultiViews

        php_admin_value open_basedir ".:/var/www/domain.com/weblog/"
        php_admin_value include_path ".:/var/www/domain.com/weblog/"

        php_admin_value safe_mode_include_dir ".:/var/www/domain.com/weblog/"
        php_admin_value safe_mode_exec_dir ".:/var/www/domain.com/weblog/"

        php_admin_value error_log "/var/logs/apache2/php_error-com_domain_weblog.log"

                <FilesMatch "^\.ht">
                    Order allow,deny
                    Deny from all
                </FilesMatch>

        ErrorDocument 404 default
        ErrorDocument 403 default
        ErrorDocument 500 default

        </Directory>

        # This ErrorDocument settings also redirecting 404 and 403
        # weblog.domain.com to itself, but also applying if the requested
        # name.weblog.domain.com doesnt exists

        ErrorDocument 403 http://weblog.domain.com/
        ErrorDocument 404 http://weblog.domain.com/
	ErrorDocument 500 default

        RewriteEngine on
        RewriteLogLevel 0
        RewriteCond   %{HTTP_HOST}                 ^[^.]+\.weblog\.domain\.com$
        RewriteRule   ^(.+)                        %{HTTP_HOST}$1          [C]
        RewriteRule   ^([^.]+)\.weblog\.domain\.com(.*) /var/www/domain.com/weblog/weblogs/$1/$2
</VirtualHost>


regards,

twobee.
-=( Experienced Apache 2.0.x Administrator )=-
Post Reply