Configure Odoo 8 subdomain filtering on a Linux VPS
5 March, 2021 by
Configure Odoo 8 subdomain filtering on a Linux VPS
Administrator
| No comments yet


 

Odoo in one of the most commonly used business applications at the moment. It can be configured to use sub-domain filtering so the users can run different Odoo databases on different sub-domains. This means you can have different Odoo website/application for different branch of your company. The Odoo sub-domain filtering is simple to configure, so if you have a Linux VPS with Odoo installed on it, you can follow this guide.

The first step is to install mod_wsgi on your server. If you have a CentOS VPS, you can run the command:

yum install mod_wsgi
Or, if you have an Ubuntu VPS, you can run these commands to install and enable the same Apache module:

apt-get install libapache2-mod-wsgi
a2enmod wsgi
Next step is to add the ‘dbfilter = ^%d$’ to your Odoo configuration file. Open your Odoo configuration file using your favorite text editor and add the following line:

dbfilter = ^%d$
We assume that your Odoo configuration file is saved in your /etc directory, so to edit the file using the ‘nano’ text editor you need to run:

nano /etc/odoo-server.conf
Next, open the ‘/opt/odoo/openerp/tools/config.py’ file

nano /opt/odoo/openerp/tools/config.py
and change:

“–db-filter”, dest=”dbfilter”, my_default=’.*’
to:

“–db-filter”, dest=”dbfilter”, my_default=’%d’
We assume that your Odoo is installed in your /opt directory. If Odoo is installed in another directory, you should find and edit the corresponding file.

One of the last things you need to do is to create an Apache virtual host. The Apache virtual host should contain the following lines:
ServerName example.com
ServerAlias *.example.com
WSGIScriptAlias / /opt/odoo/openerp-wsgi.py
WSGIDaemonProcess oe user=odoo group=odoo processes=2 python-path=/opt/odoo/ display-name=apache-odoo
WSGIProcessGroup oe
ErrorLog /var/log/odoo/odoo-error.log
CustomLog /var/log/odoo/odoo-access.log combined

#Order allow,deny
#Allow from all
Options All
AllowOverride All
Require all granted

Again, you can edit the virtual host to match your needs. Of course, you need to use a valid domain name which should be pointed to your server IP address.

In order to get the Odoo sub-domain filter to work, you need to create sub-domains and point them to your Linux VPS IP address. To complete this task, you need to edit the zone file of your domain name.

Last but not least, you need to create separate databases for your sub-domains. Open your favorite web browser and navigate to:

http://example.com:8069/web/database/manager
Change example.com with your domain name. Here, you need to create new databases to match your sub-domains. For instance, if you like to have a separate database for your sales department and your sales.example.com sub-domain, you need to create a ‘sales’ database. After you complete this step, you need to restart your Apache web server and your Odoo. You should be able to access your new Odoo database and test the sub-domain filtering at:

http://sales.example.com:8069

Sign in to leave a comment