Ask Your Question
1

How to server mutliple instances of Askbot in different directories using Apache?

asked 2013-03-06 05:36:08 -0600

Vincent_de_Belgique gravatar image

updated 2016-12-22 09:23:08 -0600

Evgeny gravatar image

Hello,

is it possible to have mutliple instance of askbot in differents directories on the same virtual host ?

ex: https://www.example.org/askbot1 and https://www.example.org/askbot2

They will not share the database, nor the users.

And if it's possible, what is the best way to do it : follow the install procedure from de begining to the end two times in the separates directories, or we can share some parts of the code or something ?

Thank you in advance for your help.

Vincent

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
1

answered 2017-01-09 10:53:08 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >100 is welcome to improve it.

It's very simple. Each instance of Askbot has its folder in /var/www. Apache config is:

# path and name used for sockets
WSGISocketPrefix /var/run/socket
# make sure it's running as a daemon
WSGIRestrictEmbedded            On
# initialize wsgi script on server start
WSGILazyInitialization          On

<VirtualHost *:80>

ServerAdmin                 admin@domain.com
ServerName                  askbot.domain.com
DocumentRoot /var/www

# No permission to list directories
<Directory /var/www>
    Options -Indexes
</Directory>

# Alias for "media"
AliasMatch                  ^/m_([^/]+)/(.*)        /var/www/$1/static/$2

# Alias for "upfiles"
AliasMatch                  ^/upfiles_([^/]+)/(.*)$ /var/www/$1/askbot/upfiles/$2

# Alias for *.wsgi script
WSGIScriptAliasMatch        ^/(?!/admin)([^/]+)     /var/www/$1/django.wsgi

# Use separate .conf file for each askbot instance
# the main config doesnt have to be modified
IncludeOptional             askbot-enabled/*.conf

# get names for application-group from askbot instance name
RewriteEngine               On
RewriteCond                 %{REQUEST_URI}          ^/([^/]+)
RewriteRule                 . - [E=ABGROUP:%1]

WSGIApplicationGroup        %{GLOBAL}
WSGIProcessGroup            %{ENV:ABGROUP}

<FilesMatch "\.(html|js|png|jpg|css|gif|ttf)$">
    ExpiresDefault "access plus 2 months"
    ExpiresActive On
</FilesMatch>

CustomLog /var/log/apache2/askbot_access.log common
ErrorLog /var/log/apache2/askbot_error.log
LogLevel notice

</VirtualHost>

Make sure you have config for each instance in IncludeOptional path. Sample.conf

WSGIDaemonProcess       instanceName     display-name=%{GROUP}

and make sure to edit settings.py in each instance and make following changes:

MEDIA_URL = '/upfiles_instanceName/'
STATIC_URL = '/m_instanceName/'#this must be different from MEDIA_URL
SESSION_COOKIE_NAME = 'instanceName'

That's all i remember. Might be something else to do to make it working

edit flag offensive delete link more
0

answered 2013-03-06 20:09:45 -0600

Evgeny gravatar image

Try this: in your webserver config set up alias to your script for each site (example for apache)

WSGIScriptAlias /sub-url /path/to/wsgi_script

And in the settings.py add:

FORCE_SCRIPT_NAME = 'sub-url'

I have not tested this - please check that slashes are set correctly.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2013-03-06 05:36:08 -0600

Seen: 304 times

Last updated: Jan 09