How to Install Odoo 10 on Ubuntu 16.04 with Nginx as a Reverse Proxy

In this tutorial we will show you how to install Odoo 10 on Ubuntu 16.04. We will also show you how install and configure the Nginx web server as a reverse proxy for your Odoo application. Odoo is a web-based open source business software including a number of business applications for Sales, Project and Warehouse management, CRM, Website/eCommerce, billing, accounting, inventory and thousands of more additional modules developed by the community. There are two Odoo editions currently available, the Community edition which is free and Enterprise edition. For the purposes of this tutorial we will be using the Odoo 10 Community edition.

Requirements

  • Ubuntu 16.04 VPS
  • PostgreSQL server
  • Python version 2.7
  • Nginx web server
  • SSH access with root privileges

1. Connect to your server

Before we begin,you need to connect to your server via SSH.  Also, if this is your first time loging to your VPS make sure you check out our First Steps After Getting an Ubuntu VPS tutorial.

To connect to your server via SSH as user root, use the following command:

ssh [email protected]IP_ADDRESS -p PORT_NUMBER

and replace “IP_ADDRESS” and “PORT_NUMBER” with your actual server IP address and SSH port number.

Once logged in, make sure that your server is up-to-date by running the following commands:

apt-get update
apt-get upgrade

2. Install PostgreSQL server

We will be using PostgreSQL as a database server for our Odoo application. To install PostgreSQL on your server, run the following command:

apt-get install postgresql

After the isntallation is complete, make sure to enable the PostgreSQL server to start automatically upon server reboot with:

systemctl enable postgresql

3 . Install Odoo

Because Odoo is not available in the official Ubuntu 16.04 repository, we will need to manually add the Odoo repository before we can do the installation. To do this, run the following commands:

wget -O - https://nightly.odoo.com/odoo.key | apt-key add -
echo "deb http://nightly.odoo.com/10.0/nightly/deb/ ./" >> /etc/apt/sources.list.d/odoo.list

Update the list of available packages with:

apt-get update

And run the following command to install Odoo, along with Python and all required Python modules:

apt-get install odoo

After the installation is complete, you can run the following command to check the status of your Odoo service:

systemctl status odoo

You should get the following output:

● odoo.service - LSB: Start odoo daemon at boot time
Loaded: loaded (/etc/init.d/odoo; bad; vendor preset: enabled)
Active: active (running)
Docs: man:systemd-sysv-generator(8)
CGroup: /system.slice/odoo.service
└─5416 /usr/bin/python /usr/bin/odoo --config /etc/odoo/odoo.conf --logfile /var/log/odoo/odoo-server.log

You will also need to set a new master password. To do this you need to edit the odoo configuration file with:

nano /etc/odoo/odoo.conf

And change admin_password field with a strong password. You can also generate one using the command line.

admin_passwd = StrongPassword

After you made the changes, restart your Odoo with:

systemctl restart odoo

To access Odoo, you can now open your browser and navigate to http://your-server-IP:8069.

4. Setting up Reverse Proxy

If you have a valid domain name and you would like to use it in order to access your Odoo application instead of typing the IP address and the port number in the URL, we will now show you how how set up a reverse proxy using the Nginx web server.

Let’s start with the Nginx web server installation. To install Nginx on your server run the following command:

apt-get install nginx

To enable the Nginx web server to start automatically upon server reboot, execute the following command

systemctl enable nginx

Next, we need to create a new Nginx server block for our domain name. Let’s say our domain is called “domain.com” (you can replace this with your actual domain name). Run the following command:

nano /etc/nginx/sites-available/domain.com

and enter the following content and save the file:

upstream odoo {
server 127.0.0.1:8069;
}

server {
listen 80 default;
server_name odoo.com;

access_log /var/log/nginx/domain.com.access.log;
error_log /var/log/nginx/domain.com.error.log;

proxy_buffers 16 64k;
proxy_buffer_size 128k;

location / {
proxy_pass http://odoo;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
proxy_redirect off;

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
}

location ~* /web/static/ {
proxy_cache_valid 200 60m;
proxy_buffering on;
expires 864000;
proxy_pass http://odoo;
}
}

To enable the virtual server block we have just created, run the following command:

ln -s /etc/nginx/sites-available/domain.com /etc/nginx/sites-enabled/domain.com

Restart the Nginx web server:

systemctl restart nginx

That’s it. If you followed all the instructions properly you can now access your Odoo 10 using your domain name at http://domain.com.

Initially you would be asked to create a new database using the master password we have set up earlier. Once the database is created, you will get redirected to the admin panel from where you can log in as an admin user. After you have successfully logged in, you can start using your Odoo 10 and configure it to your needs, install additional modules etc.


Install Odoo 10 on Ubuntu 16.04 with Nginx as a Reverse ProxyOf course, you don’t have to know how to install Odoo 10 on Ubuntu 16.04 with Nginx as a Reverse Proxy if you have a Odoo VPS Hosting with us. You can simply ask our administrators to install Odoo 10 on Ubuntu 16.04 for you. They’re available 24/7, and will be able to help you with the installation of Odoo 10 on Ubuntu 16.04.

PS. If you enjoy reading this blog post on How to Install Odoo 10 on Ubuntu 16.04 with Nginx as a Reverse Proxy, feel free to share it on social networks using the shortcuts below, or simply leave a comment.