« Back to Blogs

Configure Apache Web Server with Odoo

Odoo is very well known ERP system today. Odoo 9 provides great features that will help to grow business. By default odoo runs over port 8069. So we are accessing server using domain:8069. What if we need to access server using only domain like a standard website? We can do it by configuring web server with odoo. Here I am going to show you configuration of Apache web server for odoo.
Before configuring apache with odoo, first check whether apache web server is installed on your machine or not. If not installed then execute below command to installed it.

sudo apt-get update

sudo apt-get install apache2

After installing apache on your machine, you need to enable some modes by executing below commands.
sudo a2enmod proxy proxy_http
Now go to the directory, “/etc/apache2/sites-available” and create a file with <domain-name>.conf.  Here I am going to use “demo.surekhatech.com” domain for my odoo server. So the file name will be “demo.surekhatech.conf”. Add the below content into this file.
<VirtualHost *:80>
    ServerName demo.surekhatech.com
    ServerAlias demo.surekhatech.com

    LogLevel warn
    ErrorLog /var/log/apache2/demo.surekhatech.com.error.log
    CustomLog /var/log/apache2/demo.surekhatech.com.access.log combined

    ProxyPass / http://localhost:8069/
    ProxyPassReverse / http://localhost:8069/
After adding the virtual host for odoo server, you need to enable site using the following command.
sudo a2ensite demo.surekhatech.conf
A message will appear showing that site is enabled. After that you need to restart the apache server by executing below command.
sudo service apache2 restart
Make the host file entry in case you have made the configuration on the local machine. Open the “hosts” file by executing below command:
sudo nano /etc/hosts
Add the following entry into this file. demo.surekhatech.com
After completing with above configuration, you can access the odoo server by hitting the “demo.surekhatech.com” in any browser. You can see that the odoo server is running over the “http”. But what if we need to run our odoo server over more secure channel i.e. “https”.
For that you need SSL certificate and key. You can buy the certificate from any trusted vendor. You can also generate certificates and used it. Certificate can be generated using the openssl toolkit. For linux machine you can generate certificate by using the following commands.
To generate key:
openssl genrsa -out demo.surekhatech.com.key 2048
To generate Certificate:
openssl req -new -x509 -key demo.surekhatech.com.key -out demo.surekhatech.com.cert -days 3650
-subj /CN=demo.surekhatech.com
Once you have SSL key and certificate, you need to update the existing virtual host to run odoo server over “https”. Before that first enable the apache SSL mode by executing below command.
sudo a2enmod ssl
Now open “demo.surekhatech.conf” file from the “/etc/apache2/sites-available” and update the virtual host with the below contents.
<VirtualHost *:80>
     ServerName demo.surekhatech.com
     ServerAlias demo.surekhatech.com
     Redirect / https://demo.surekhatech.com/

<VirtualHost *:443>
     ServerName demo.surekhatech.com
     ServerAlias demo.surekhatech.com

     LogLevel warn
     ErrorLog /var/log/apache2/demo.surekhatech.com.error.log
     CustomLog /var/log/apache2/demo.surekhatech.com.access.log combined

     SSLEngine on
     SSLProxyEngine on
     SSLCertificateFile /etc/apache2/ssl/demo.surekhatech.com.cert
     SSLCertificateKeyFile /etc/apache2/ssl/demo.surekhatech.com.key

     ProxyPreserveHost On
     ProxyPass / http://localhost:8069/ retry=0
     ProxyPassReverse / http://localhost:8069/
Here we have added the path for the SSL certificate and key file. Create a directory with “ssl” name on “/etc/apache2” location. Copy the SSL certificate and key files into “/etc/apache2/ssl” directory.
Now restart the apache web server using the following command. 
sudo service apache2 restart
Open any browser and hit the url “demo.surekhatech.com”. You can see that it will automatically redirect your odoo server over “https”, a more secure channel. Any request to your odoo server will be serve over the “https”.
For more implementation details or support you may contact us at [email protected]
Trackback URL:

Herzth David
good informative post.
odoo 9 is a powerful tool for creating customized ERP solutions
we are <a href ="http://www.atees.org/>odoo training institute in thrissur</a>
looking forward to your next post
Posted on 8/22/16 6:57 AM.
Nilesh Patel
How can we setup subdomain(By dbfilter) with https on Odoo?
Posted on 2/7/17 2:27 PM in reply to Herzth David.
pat pat
Thank you very much, this is a great tutorial
Posted on 2/22/17 6:03 AM.
palani p
I have configured the odoo with apache
by using above link..

How can i upload the odoo source code( addons folder) into my website directory (www.xxxxx.tk) ?
Posted on 6/28/17 7:19 AM.
Megha Sirisilla
I have followed the instructions and so far what I was able to do was connect to the default page of Apache instead of getting connected to my Odoo service.
Can you tell me where I'm going wrong?
Posted on 5/2/18 5:34 PM.
Timo Sivula
Great config and works well. The drawback is that it proxies everything to port 8069, making running other services impossible.
To run e.g. /otherservice add a proxy exception between
ProxyPreserveHost On
ProxyPass / http://localhost:8069/ retry=0
Like so:
ProxyPreserveHost On
ProxyPass /otherservice !
ProxyPass / http://localhost:8069/ retry=0
And you are good to go!
Posted on 8/20/18 10:41 AM.
Don Leaman
My Odoo is in a VirtualBox Ubuntu VM with an Ubuntu host. What differences must I make to your tutorial in order that I can connect to my Odoo from the internet using HTTPS?
Posted on 2/2/19 7:55 AM.
Ali Raza
I am unable to found demo.surekhatech.com.cert and demo.surekhatech.com.key file and i excute this command openssl req -new -x509 -key demo.surekhatech.com.key -out demo.surekhatech.com.cert -days 3650 please help me.
Posted on 6/7/20 2:50 PM.
thomas .
Apache itself is one of the finest web server for general purpose. Adding it with odoo will definitely boost the feature of the system. I have came across many such web services companies like India access and hostasp. One can checkout over there too.
Posted on 9/14/20 1:40 PM.
contact-us Request a callback WhatsApp