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:
Next, open the ‘/opt/odoo/openerp/tools/config.py’ file
"--db-filter", dest="dbfilter", my_default='.*'
"--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:
<VirtualHost *:80> 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 <Directory /opt/odoo> #Order allow,deny #Allow from all Options All AllowOverride All Require all granted </Directory> </VirtualHost>
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:
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:
Of course you don’t have to do any of this if you use one of our Linux VPS hosting services, in which case you can simply ask our expert Linux admins to configure Odoo subdomain filtering for you. They are available 24×7 and will take care of your request immediately.
PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.