Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

How to make Odoo 8 webshop go to custom web address?

By
Yenthe
on 10/9/14, 3:35 AM 6,281 views

Hey everybody

Today I'm doing some research about Odoo V8 and its webshop. I managed to get one online on an IP address but now I'd like to take this a step further.
Is it possible to have a VPS with ip XXX.XXX.XXX.XXX where Odoo is running on port 8069 to forward to www.mywebaddress.com?
If I'd have IP 192.168.111.111 and the Odoo instance is running on port 8069 I would like to enter www.mywebaddress.com in place of http://192.168.111.111:8069

What I would like to achieve is the following:

  • Surf to URL without entering IP
  • Surf to URL without any ports behind it (e.g www.mywebaddress.com:8069)
  • All pages are shown as www.mywebaddress.com

Has anybody done this yet and/or has a guide about this?

Thank you
Yenthe

1

Luke Branch

--Luke Branch--
1531
| 6 7 8
Mui Wo, Lantau, Hong Kong
--Luke Branch--

...

Luke Branch
On 10/9/14, 4:23 AM

@Yenthe,

I'll write a guide later, however i'd recommend you refer to this post:

https://www.odoo.com/forum/help-1/question/how-to-show-the-manage-database-page-for-particular-user-like-administrator-in-openerp-v8-57036#answer-64772

as follows:

In order to restrict access to  /web/database/selector and /web/database/manager I have setup nginx as a frontend proxy in front of Odoo's webserver and applied the following rules to the /sites-enabled/examplewebsite.com (add inside server {}):

location ~ ^ /web/database(manager|selector) { 
                      allow 1.2.3.4;
                      deny all;
}

simply replace 1.2.3.4 with an ip (preferably fixed ip) of your choice. I have replaced it with an ip address inside my internal LAN. This will provide anyone who is not trying to access that URL from that IP address a 403 Forbidden error from nginx.

In order to setup Nginx as a frontend proxy for Odoo I have used the following steps on Debian 7.6:

1) sudo apt-get install nginx
2) sudo pico -w /etc/nginx/sites-enabled/examplewebsite.com
3) paste the following and replace examplewebsite.com with your domain, and 1.2.3.4 with the fixed IP address you would like to access your /web/database/manager and /web/database/selector links from:

server {
           
          listen 80;
          server_name  www.examplewebsite.com examplewebsite.com;
          charset utf-8;
                                                                                                                                                                     
          access_log  /var/log/nginx/prolv-access.log;                         

          error_log   /var/log/nginx/prolv-error.log;  

  location ~ ^/web/database/(manager|selector) {
                allow 1.2.3.4;
                deny all;
  }

                location / {
                    proxy_pass         http://127.0.0.1:8072/;
                    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-OpenERP-dbfilter prolv;

                    client_max_body_size       200m;

                #    proxy_connect_timeout      90;
                #    proxy_send_timeout         90;
                #    proxy_read_timeout         90;

                    proxy_buffer_size          128k;
                    proxy_buffers              16 64k;
                #    proxy_busy_buffers_size    64k;
                #    proxy_temp_file_write_size 64k;
                }

                # Static files location
                #location ~* ^.+.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js)$ {
                #    root   /spool/www/members_ng;
                #}

              

}


Credit to Viktor for his basic Nginx config for Odoo 8.0 here
http://www.prolv.net/forum/help-1/question/nginix-setup-for-odoo-6

and NixCraft for their explanation of Nginx Access rules here:
http://www.cyberciti.biz/faq/nginx-block-url-access-all-except-one-ip-address/


Although this is by no means a complete or production ready configuration it has at least helped me to achieve restricting access to those URL's to a specific IP. I will be rolling a more complete nginx configuration into my Odoo 8.0 install script (forked and modified from Andre Schenkel's here - https://github.com/lukebranch/openerp-install-scripts/blob/master/odoo-saas4/ubuntu-14-04/odoo_install.sh).

There are probably better ways to do this and I welcome any comments on how this might be better implemented.


 

You'll need to setup a frontend proxy for Odoo (eg. I have used Nginx above), and you'll need to point your domain's A records for the over to the IP of your VPS. I'd recommend either using DNS hosting (such as google's DNS - https://cloud.google.com/dns/) or any other DNS hosting service in order to do this. I'm currently using the above explained setup to host a number of Odoo instances for public websites now so I know it works at a basic level.


I'll be forking my script (forked and modified from Andre Schenkel's original script here - https://github.com/lukebranch/openerp-install-scripts/blob/master/odoo-saas4/ubuntu-14-04/odoo_install.sh) very shortly to create a complete server setup with Nginx as a frontend proxy for Odoo, as well as a full open-source control panel using Ajenti (http://ajenti.org/) as soon as I can find time. In the meantime you may want to refer to Ivan Yelizariev's answer on my post here: 

https://www.odoo.com/forum/help-1/question/how-to-install-odoo-from-github-on-ubuntu-14-04-for-testing-purposes-only-ie-not-for-production-52627

Wow this looks as a good start, thank you Luke. So in essence it would come down to this: 1. setup Nginx so users can never see or access anything database related. 2. Setup a DNS a record that forwards the IP to the web address. Is that correct? And how about the :8069, could this be left out too? I'm looking forward to a full guide!

Yenthe
on 10/9/14, 4:36 AM

About the port: nevermind I see this in your configuration setup you've posted :)

Yenthe
on 10/9/14, 4:39 AM

@Yenthe, Glad it helped. Feel free to post back here with any issues. I'll post back here with a full guide and updated script when I can find some time to put everything together.

Luke Branch
on 10/9/14, 4:43 AM

@Luke I've managed to setup a VPS on Digitalocean and a domain at a webdomain hosting provider. I now managed to redirect my weburl to the servers Odoo instance (www.mywebsite.com:8069/) with A-records and DNS. I'm now wondering what exactly I need to do in my Ubuntu VM to be able to do www.mywebsite.com and to make it run/open/... www.mywebsite.com:8069 in the background without showing it in the url or something. Just any method to access my Odoo instance without the :8069. Could you provide some more details/guidance for this please? If I get this working I will post a full guide for others too.

Yenthe
on 10/11/14, 9:34 AM

Hi Yenthe, with the guide above, if you are running Odoo on port :8069 then change the following line in your nginx sites-enabled config file from: http://127.0.0.1:8072/ to: http://127.0.0.1:8069/ your DNS A records should look something like this: 1.2.3.4 www.examplewebsite.com where 1.2.3.4 is the fixed IP that your Odoo instance is running on and www.example.com is the domain you want to host your Odoo instance on. if your nginx configuration file is setup the same as the above example with your own domain instead of example domain then if you try to visit www.exampledomain.com (replace with your domain) you should see your Odoo instance running on your domain. You can stop people seeing your Odoo instance at the 1.2.3.4:8069 ip (replace 1.2.3.4 with your Digital Ocean droplet's ip) by simply using ufw and blocking the port. If ufw is not installed on your droplet just do the following at a terminal: sudo apt-get install ufw sudo ufw deny 8069 This will use the ufw firewall to block the :8069 port from public access, therefore making your Odoo instance only accessible through the nginx proxy.

Luke Branch
on 10/12/14, 9:47 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

3 follower(s)

Stats

Asked: 10/9/14, 3:35 AM
Seen: 6281 times
Last updated: 3/16/15, 8:10 AM