Setup Nginx as a reverse proxy for sub-domain with Odoo (OpenERP) on Google Cloud Platform
How to setup Nginx as a reverse proxy for sub-domain with Odoo (OpenERP) on Google Cloud Platform ?
What is Odoo also known as OpenERP ?
Odoo is an open source ERP [Enterprise Resource Planning] platform that is freely available and anyone can customize it based on their organization/process requirements. Odoo is an abbreviation for On-Demand Open Object. It’s basically a large set of business/operations modules like CRM, Sales, Inventory, Warehouse, HRMS etc and that essentially form a basis of any ERP Software package. More about Odoo.. Read here
Odoo on Google Cloud Platform
Odoo is provided as an application by Bitnami on the GCP Marketplace.
On your GCP Console you can goto Marketplace or click on this link to open the Odoo offering.
As you can see, there is no usage/license fee for Odoo usage, it is only the Compute Engine costs that you need to incur.
Sub-domains with Odoo
I have often come across situations where internal divisions use different modules of the Odoo package and they would like to host it as sub-domains under their organization.
Say your company domain is openerp.com and you want the HRMS module to be available as hrms.openerp.com. Likewise if you have several such sub-domains how do you configure this using Nginx as a reverse proxy.
Reverse Proxy : A reverse proxy is an intermediary proxy service which takes a client request, passes it on to one or more servers, and subsequently delivers the server’s response to the client.
Nginx Reverse proxy has quite some benefits like Load Balancing, Increased Security, Better performance and easy audit logs. ## Let us now begin with our configuration of Nginx reverse proxy for sub-domains - SSH into your VM Note : Use ‘sudo’ if you are not a root user and install nginx
1 2 apt-get update apt-get install nginx
Within the /etc/nginx/sites-available directory, we shall create the configuration that is responsible for the reverse proxy information and management. Name this file as the sub-domain itself, something like hrms.openerp.com (Not mandatory, but in future if you keep on increasing sub-domains it would just become easy to remember this naming convention).
Once this file is created, you need to activate it by linking it to sites-enabled using the command -
1 ln -s /etc/nginx/sites-available/hrms.openerp.com /etc/nginx/sites-enabled
Now just restart your nginx and you are good to proceed.
1 sudo systemctl restart nginx
Test your application on any browser -
Note : You must have your DNS entries pointing to your server before applying these steps.
The above configuration also solves the following configuration problems generally encountered -
Redirect HTTP to HTTPS
Reverse Proxy on nginx for custom ports
Finally, in order to get your sites marked as secured whenever someone visits it, ensure that you have set the right SSL protocols and ciphers in your nginx configs and also preferably use certificates from Let’s Encrypt.