ansible-roles/roles/odoo/templates/nginx.conf.j2

48 lines
1.4 KiB
Django/Jinja

server {
listen 443 ssl http2;
server_name {{ odoo_public_url | default('https://_/') | urlsplit('hostname') }};
root /usr/share/nginx;
location /websocket {
proxy_pass http://localhost:{{ odoo_gevent_port }};
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
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;
}
location /web/filestore {
internal;
alias {{ odoo_root_dir }}/filestore;
}
location @odoo {
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;
proxy_redirect off;
proxy_pass http://localhost:{{ odoo_http_port }};
}
location ~ ^/[^/]+/static/.+$ {
root {{ odoo_root_dir }}/app/addons;
try_files {{ odoo_root_dir }}/enterprise$uri {{ odoo_root_dir }}/app/addons$uri {{ odoo_root_dir }}/app/odoo/addons$uri @odoo;
expires 24h;
}
location / {
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;
proxy_redirect off;
client_max_body_size 100m;
proxy_pass http://localhost:{{ odoo_http_port }};
}
}