Anarchopedia:en:administration/virtual hosts configuration
From Anarchopedia
This is configuration for virtual hosts in Apache2 which is running Anarchopedia:
HTTPD configuration[edit]
NameVirtualHost LANGUAGE.anarchopedia.org:*
<VirtualHost LANGUAGE.anarchopedia.org>
ServerAdmin SERVERADMIN
ServerName LANGUAGE.anarchopedia.org
ServerAlias www.LANGUAGE.anarchopedia.org
ServerAlias LANG2.anarchopedia.org
ServerAlias www.LANG2.anarchopedia.org
DocumentRoot VHOSTROOT/langs/LANGUAGE
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory VHOSTROOT/langs/LANGUAGE>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
# This directive allows us to have apache2's default start page
# in /apache2-default/, but still have / go to the right place
# RedirectMatch ^/$ /apache2-default/
</Directory>
ScriptAlias /cgi-bin/ VHOSTROOT/cgi-bin/LANGUAGE
<Directory "VHOSTROOT/cgi-bin/LANGUAGE">
AllowOverride None
Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog VHOSTROOT/logs/error-LANGUAGE.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog VHOSTROOT/logs/access-LANGUAGE.log combined
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>
php_value include_path .:./include:VHOSTROOT/include:VHOSTROOT/phplib:VHOSTROOT/include/LANGUAGE:VHOSTROOT/phplib/LANGUAGE:VHOSTROOT/langs/LANGUAGE/include
<Files .*>
Order Deny,Allow
Allow From All
</Files>
# Allow rewriting URLs
RewriteEngine on
# The following rules are only for backwards compatibility
# (so that old links to your site keep working). You should leave them out in a new install.
# Redirect old /wiki/ urls
RewriteRule ^/wiki/(.*)$ http://LANGUAGE.anarchopedia.org/$1 [R,L]
# Redirect old /wiki.phtml?title= and index.php urls
RewriteRule ^/wiki\.phtml\?title=(.*)$ http://LANGUAGE.anarchopedia.org/$1 [R,L]
RewriteRule ^/index.php\?title=(.*)$ http://LANGUAGE.anarchopedia.org/$1 [R,L]
RewriteRule ^/index.php/(.*)$ http://LANGUAGE.anarchopedia.org/$1 [R,L]
# end backward compatibility rules, the following ones are important
# Don't rewrite requests for files in MediaWiki subdirectories,
# MediaWiki PHP files, HTTP error documents, favicon.ico, or robots.txt
RewriteCond %{REQUEST_URI} !^/(stylesheets|images|skins)/
RewriteCond %{REQUEST_URI} !^/(redirect|texvc|index).php
RewriteCond %{REQUEST_URI} !^/error/(40(1|3|4)|500).html
RewriteCond %{REQUEST_URI} !^/favicon.ico
RewriteCond %{REQUEST_URI} !^/robots.txt
RewriteRule ^/(.*)$ /index.php?title=$1 [L,QSA]
</VirtualHost>
Notes about rewrite rules[edit]
- Our rewrite rule doesn't work with amparsan sign in the article name, so don't use this. (Reference: Rewrite rules from Meta.Wikipedia.)
- During the process of initialization of MediaWiki rewrite rules should not exist because installation is imposible.