Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
145 Widoki

I have setup odoo (including an ecommerce site) on a linode server (Odoo v15), community edition).  Within the Odoo setup I have also setup a second website (for a different region).  Each website has their own domain name.  Thanks to some help I got here I have the two websites working quite well together,  the 2 sites share a few pages (including the sale items etc) and things are good.  

I am just having one last issue I have not been able to resolve.  And, I think this issue is having a negative effect on people finding my second site (for the other region).  The situation is that if i go to a browser and enter the full address for the second site (with the 'www') it works - the second site comes up.  However, if I go to a browser and enter the address of the second site (without the 'www'), the browser actually takes me to my first site.  In other words, if I try to go to the second site via a browser (just by putting in the address) it will take me to the first site unless I specify the 'www' in the address.

I am not sure whether the problem is within my odoo setup or within any of my domain settings etc on the linode side.  Any ideas on what I might be able to do to resolve this issue?  Many thanks in advance.


Awatar
Odrzuć
Najlepsza odpowiedź

Hello,

The cause of the problem you are facing may vary. From my experience, this can be from an incorrect setup in domain registrar which is having a domain redirection set up. If you are running multiple website in odoo (in a single database) you need to disable domain redirection from registrar and also point both domain using "A record" to your VPS Public IP address which in this case you are using linode.


Then, the second setup it is from Nginx configuration side inside /etc/nginx/sites-enabled. It is best to split each domain with different files. For example if you have website1.com and website2.com, then you need to make 2 files inside that folder. Inside, you need to define server_name parameter with and without www (this is important).


Here's the nginx example .conf that you can try :


https://drive.google.com/drive/folders/1TXtpqmzrG-WCcOi56dK6EprRy1OUVWIG?usp=sharing


hope this helps,


Altela (www.altelasoftware.com)

Awatar
Odrzuć
Autor

Hello and thank you very much for your thorough reply.

When you say to disable domain redirection - is that something that would have been set within the domain setup on linode? If so, I do not see anything there that would redirect (although not even sure where that would necessarily be defined). I do have "A record" set within the Linode setup for the domain which specifies the IP address.

The Nginx configuration might be more interesting (and perhaps has something incorrect). within /etc/nginx directory I do not have a system-enabled directory, however, I do have a sites-enabled directory (and there really isn't anything in it. Within the /etc/nginx/conf.d directory I do have files for each of the sites (website1.ca.conf and website2.net.conf). Each of these files do contain references to their respective site name (eg. the website1 file has lines such as root var/www/website1.ca, server_name www.website1.ca).

Autor

i did forget to mention that the letsencrypt ssl certificate lines in each file (website1 and website2) both reference website1 in the line. In other words the letsencrypt ssl certificate lines in the website2 file do reference website 1.

My bad, you are correct it is sites-enabled and not system-enabled. i will edit my answer

The domain redirection most commonly handled in registrar site (where you are purchasing domain) if there are no domain redirection set then i think its already correct.

For Nginx part i usually add the configuration files for each website in /etc/nginx/sites-enabled. The point we set nginx is to route the traffic for which domain is accessing to which website. So at the end we will expect the route to be come like : user typing domain in web browser -> registrar directing domain to "A Record" (VPS IP address) -> Nginx directing user to which website -> Website will show in the browser

i think there's more to do in your Nginx site to do some redirecting. You can leave SSL at the end once all is well accessed