First time here? Check out the FAQ!
2

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

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

Vincent_de_Belgique's avatar
21
Vincent_de_Belgique
asked 2013-03-06 05:36:08 -0600
Evgeny's avatar
13.2k
Evgeny
updated 2017-01-27 09:10:14 -0600
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

2 Answers

0

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.

Evgeny's avatar
13.2k
Evgeny
answered 2013-03-06 20:09:45 -0600
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments
1

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

answered 2017-01-09 10:53:08 -0600
This post is a wiki. Anyone with karma >100 is welcome to improve it.
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments