how to configure reverse proxy nginx odoo ERP in docker

0

I have a docker container with odoo on port 8069 and another docker container with postgres on port 5432, I am mounting another container with nginx since the odoo container must handle two databases (db1-mydomain-com, db2 -mydomain-com) and the respective domains are db1.mydomain.com and db2.mydomain.com

The problem is that I am not aware of how to configure this correctly ... so that it is routed correctly, since I have no idea how nginx works. What I have done is the following:

Docker File:

FROM nginx
MAINTAINER Camptocamp
ADD
https://github.com/kelseyhightower/confd/releases/download/v0.11.0/confd-0.11.0-linux-amd64 /usr/local/bin/confd
RUN chmod +x /usr/local/bin/confd

RUN mkdir -p /etc/confd/{conf.d,templates}
COPY conf.d /etc/confd/conf.d
COPY templates /etc/confd/templates
COPY docker-entrypoint.sh /docker-entrypoint.sh

ENTRYPOINT ["/docker-entrypoint.sh"]

ENV NGX_ODOO_HOST=odoo

CMD ["nginx", "-g", "daemon off;"]

docker-compose:

version: '3'
services:
  nginx:
      build:
          context: ./
          dockerfile: Dockerfile
      ports:
        - "80:80"
      volumes:
        - ./code:/code
        - ./nginx.conf:/etc/nginx/conf.d/default.conf
    
asked by 14.09.2018 в 02:28
source

1 answer

0

You can find an example in this repository that will link you in the connect a php-fpm with nginx. link

But for your question to be resolved, what you should do is create an upstream within nginx.conf with the address of your odoo

    # Defined odoo servers
    upstream odoo {
        server odoo:8069;
    }

and then if you already want a proxy or you want to use nginx as a server inside your configurator file, you put it

fastcgi_pass odoo;

or

proxy_pass odoo;

More information within Nginx link

    
answered by 06.10.2018 в 22:12