I have 1 Database, 2 Companies, 2 Websites and 2 separate domains installed on Ubuntu.
No matter what I did, domain2.com always loaded domain1.com (the primary domain used in web.base.url) instead of domain2.com. After struggling many trying to figure out NGINX, i finally have domain2 pointing correctly with SSL.
However, now domain2 is only loading bare html, all other assets (images, css, js...) are being 404'd. Example:
https://domain1/web/static/img/odoo_logo_tiny.png - loads fine https://domain2/web/static/img/odoo_logo_tiny.png - doesn't load.
Here is the nginx setup for the second domain.
server {
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
server_name DOMAIN www.DOMAIN;
location / {
try_files $uri $uri/ =404;
proxy_pass http://IP_ADDRESS;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
listen [::]:443 ssl; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/domain/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/domain/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = DOMAIN) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
listen [::]:80;
server_name DOMAIN www.DOMAIN;
return 404; # managed by Certbot
}
I have looked for hours and simply do not understand how odoo/nginx is handling this multi site setup. Please help!