Community mailing list archives

RE: Create virtual hosts for odoo website on nginx (server blocks)

Bassirou Ndaw
- 10/16/2015 15:31:23



here is an example which is currently running as reverse proxy for odoo



upstream odoo-server {

    server weight=1 fail_timeout=0;



upstream odoo-server-im {

    server weight=1 fail_timeout=0;



## http redirects to https ##

server {

             listen 80;




             # Strict Transport Security

             add_header Strict-Transport-Security max-age=2592000;

             rewrite ^/.*$ https://$host$request_uri? permanent;

    #return 301 https://$host$request_uri;



server {

    listen 443;





    # Specifies the maximum accepted body size of a client request,

    #   as indicated by the request header Content-Length.

    client_max_body_size 200m;


    # ssl certificate files

    ssl on;

    ssl_certificate        /etc/ssl/certs/;

    ssl_certificate_key    /etc/ssl/private/acd.xzy.key;


    # ssl log files

    access_log    /var/log/nginx/odoo-access.log;

    error_log    /var/log/nginx/odoo-error.log;


    # add ssl specific settings

    keepalive_timeout    90;


    # increase proxy buffer to handle some OpenERP web requests

    proxy_buffers 16 64k;

    proxy_buffer_size 128k;


             #general proxy settings

    proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;


    # set headers

    proxy_set_header Host $host;

    proxy_set_header X-Real-IP $remote_addr;

    proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;


    # Let the OpenERP web service know that we’re using HTTPS, otherwise

    # it will generate URL using http:// and not https://

    proxy_set_header X-Forwarded-Proto https;


    # by default, do not forward anything

    proxy_redirect off;

    proxy_buffering off;


    location / {

        proxy_pass    http://odoo-server;



    location /longpolling {

        proxy_pass    http://odoo-server-im;



    # cache some static data in memory for 90mins.

    #     under heavy load this should relieve stress on the odoo web interface a bit.

    location ~* /web/static/ {

        proxy_cache_valid 200 90m;

        proxy_buffering    on;

        expires 864000;

        proxy_pass http://odoo-server;






Best regards

Bassirou Ndaw



From: Yassine Teimi []
Sent: Freitag, 16. Oktober 2015 20:32
To: Community <>
Subject: Re: Create virtual hosts for odoo website on nginx (server blocks)


I'm using nginx as a reverse proxy, does it impact the virtual host (server block) creation ? 


2015-10-16 19:03 GMT+01:00 Yassine Teimi <>:


I've created a server blocks (on nginx) or virtual host (on apache), i want someone to share his virtual host created under nginx, so as to compare with mine, then i'll feed you guys more informations about my concern.

Thanks for your answers.






Yassine TEIMI


Consultant & Odoo Project Manager

TEL : +212 6-27 33 30 78

Post to: