In this post, I will show you how to setup odoo port 80 so that users can easily access the service without typing the port number (say, 8069). This means that you can access your odoo instance as instead of

Our deployment will involve running the odoo instance as a mod_wsgi script. To achieve this, we will create a wsgi script file as well as a new configuration file for apache to handle incoming requests.

Install Apache Web Server on Ubuntu

First, we need to install apache web server. Many OS distributions under major VPS offerings will have this already set up. It is therefore worth checking using the command:

sudo service apache2 status

However, if apache is not installed, install it by running the following command on terminal:

sudo apt-get install apache2

Install and enable wsgi apache

In many cases, the mod_wsgi module is not installed and enabled in apache out of the box. We therefore need to install and enable it using the following commands.

sudo apt-get install libapache2-mod-wsgi

sudo a2enmod wsgi

Create odoo wsgi script

This mod_wsgi script will run the odoo instance behind apache web server.

Navigate to the directory where odoo is installed and create a file called with the following contents. In my case, odoo is installed under /opt/odoo. (Note that that is the directory that contains odoo-bin in version 10 and 11 or file.

# WSGI Handler configuration file.
import odoo
# Common
odoo.multi_process = True
# Equivalent of --load command-line option
odoo.conf.server_wide_modules = ['web'] conf =
# Path to the Odoo Addons directory/directories (comma-separated )
conf['addons_path'] = '/opt/odoo/odoo/addons,/opt/odoo/addons,/opt/odoo/custom/addons'
# Optional database config if not using local socket
conf['db_name'] = 'demo_db_name'
conf['db_host'] = 'localhost'
conf['db_user'] = 'odoo'
conf['db_port'] = 5432
conf['db_password'] = False
conf['xmlrpc_port'] = 8069
# Generic WSGI handlers application
application = odoo.service.wsgi_server.application
# Gunicorn
# Standard OpenERP XML-RPC port is 8069
bind = ''
pidfile = ''
workers = 4
timeout = 240
max_requests = 2000

Create apache configuration file under sites-enabled
Next we need to create a site configuration file to handle requests that come through our domain You will of course replace the domain with your domain name.
sudo vi /etc/apache2/sites-enabled/odoo.conf


    ServerAlias * // You can achieve dbfillter using subdomains here
    WSGIScriptAlias / /opt/odoo/
    WSGIDaemonProcess oe user=odoo group=odoo processes=4 python-path=/opt/odoo/ display-name=apache-odoo-server python-home=/opt/ou11_venv/bin/
    WSGIProcessGroup oe
    ErrorLog /var/log/odoo/odoo-error.log
    CustomLog /var/log/odoo/odoo-server.log combined
        Require all granted

The python-home argument is the path to your python virtual environment on the apache wsgi script. Remove that if you are not using a virtual environment to run your odoo instance (highly recommended).



I had a few issues running Odoo 11 as a wsgi script. After hours of seraching why my venv was not getting the required packages, I figured that there’s a separate version of wsgi_mod for python 3. To set it up:

  1. You probably already have mod_wsgi (for python 2>) So you need to uninstall it.
  2. a2dismod wsgi sudo apt-get remove libapache2-mod-wsgi

  3. Then install the right version of wsgi_mode for python 3
  4. $ sudo apt-get install libapache2-mod-wsgi-py3
    $ a2enmod wsgi

Leave a Reply

Your email address will not be published. Required fields are marked *