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

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
Vincent_de_Belgique's avatar
21
Vincent_de_Belgique
asked 12 years ago
Evgeny's avatar
13.2k
Evgeny
updated 8 years ago

Comments

see more comments

2 Answers

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

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
answered 8 years ago
This post is a wiki. Anyone with karma >100 is welcome to improve it.
link

Comments

see more comments
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.

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
Evgeny's avatar
13.2k
Evgeny
answered 12 years ago
link

Comments

see more comments