Reputation: 8350
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://odooserver;
}
# 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
Upvotes: 2
Views: 1621
Reputation: 2825
Make sure host erp.my-odoo.com
is resolvable by your server running nginx, or if your nginx is running on same server as your Odoo application, you can change upstream into localhost
or 127.0.0.1
.
upstream odooserver {
server 127.0.0.1:8069;
}
Upvotes: 4