# odoo server
upstream odoo-crymogea14ce {
	server 127.0.0.1:8110;
}

upstream odoo-crymogea14ce-chat {
	server 127.0.0.1:8111;
}

server {
	listen 80;
	server_name crymogea14ce.exigo.is;
	proxy_read_timeout 7200;
	proxy_connect_timeout 7200;
	proxy_send_timeout 7200;
	# add headers for odoo proxy mode
	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;

	# log files
	access_log /var/log/nginx/crymogea14ce.exigo.is.access.log;
	error_log /var/log/nginx/crymogea14ce.exigo.is.error.log;

	# redirect requests to odoo backend server
	location / {
		proxy_redirect off;
		proxy_pass http://odoo-crymogea14ce;
	}

	location /longpolling {
		proxy_pass http://odoo-crymogea14ce-chat;
	}

	# common gzip
	gzip_types text/css text/less text/plain text/xml application/xml application/json application/javascript;
	gzip on;
}
