Nginx – Odoo – VPS – Ubuntu
5 March, 2021 by
Nginx – Odoo – VPS – Ubuntu
Administrator
location /odoo/ {
    rewrite ^/odoo(/.*)$ $1 break;
    proxy_pass  http://localhost:8069/;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto https;
    proxy_redirect    off;
}

# This allows for someone who may have bookmarked the url with the 8069 port and redirects them to https automatically
#server {
# listen 45.32.238.8:8069;
# server_name boostthis.nl;

# add_header Strict-Transport-Security max-age=2592000;
# rewrite ^/.*$ https://$host$request_uri? permanent;
# }


# This allows for someone to go to http and get redirected to https automatically
server {
 listen 45.32.238.8:80;
 server_name boostthis.nl;

 add_header Strict-Transport-Security max-age=2592000;
 rewrite ^/.*$ https://$host$request_uri? permanent;
}
# This allows for someone who may have bookmarked the url with the 8069 port and redirects them to https automatically
server {
 listen 45.32.238.8:8069;
 server_name boostthis.nl;

 add_header Strict-Transport-Security max-age=2592000;
 rewrite ^/.*$ https://$host$request_uri? permanent;
}



 access_log /var/log/virtualmin/boostthis.nl_access_log;
 error_log /var/log/virtualmin/boostthis.nl_error_log;




External Links

https://www.digitalocean.com/community/questions/make-odoo-run-on-port-80-with-nginx

https://gist.github.com/joshuajan/8512fc37322fa79967f8

https://gist.github.com/anonymous/e6962453b54b41d7040f