Skip to Content
Menu
This question has been flagged
2 Replies
13742 Views

What should I change in the (almost) default Nginx configuration below to be able to open Odoo at `http://erp.my-odoo.com`, knowing that I've set the DNS `erp.my-odoo.com` pointing to Odoo server at `192.168.0.10` ?


`/etc/nginx/conf.d/odoo.conf`

```

# Odoo Upstreams

upstream odooserver {

    server erp.my-odoo.com:8069;

}


server {

    listen 80;

    server_name erp.my-odoo.com;

    access_log /var/log/nginx/odoo_access.log;

    error_log /var/log/nginx/odoo_error.log;



    # Proxy settings

    proxy_read_timeout 720s;

    proxy_connect_timeout 720s;

    proxy_send_timeout 720s;

    proxy_set_header X-Forwarded-Host $host;

    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

    proxy_set_header X-Forwarded-Proto $scheme;

    proxy_set_header X-Real-IP $remote_addr;


    # Request for root domain

    location / {

       proxy_redirect off;

       proxy_pass http://odoooserver;

    }


    # Cache static files

    location ~* /web/static/ {

        proxy_cache_valid 200 90m;

        proxy_buffering on;

        expires 864000;

        proxy_pass http://odooserver;

    }


    # Gzip

    gzip_types text/css text/less text/plain text/xml application/xml application/json application/javascript;

    gzip on;

}


```


This configuration gives me the error below:

```

$ sudo nginx -t

nginx: [emerg] host not found in upstream "erp.my-odoo.com:8069" in /etc/nginx/conf.d/odoo.conf:3

nginx: configuration file /etc/nginx/nginx.conf test failed

```

Avatar
Discard
Best Answer

Hi, you can follow this: https://youtu.be/-3wV7A_4s-w

Hope it helps

Avatar
Discard
Best Answer

If your Odoo service is running on 192.168.0.10 then the upstream should say:

# Odoo Upstreams
upstream odooserver {
    server 192.168.0.10:8069;
}

If Odoo is running on the same machine as nginx, you could also say:

# Odoo Upstreams
upstream odooserver {
    server 127.0.0.1:8069;
}
Avatar
Discard
Related Posts Replies Views Activity
2
Sep 24
1286
1
May 24
2662
1
Jun 20
5716
0
Oct 17
3106
2
Jun 16
12899