Second website on Linode server?
I have setup a Linode server that runs Odoo. Currently, there is one website associated with it. I know that within my installation of Odoo I can actually setup/manage a second website. However, I am uncertain whether I can also support a second website on my Linode server or whether I need to setup a second Linode for that. If I can have a second website running from my existing Linode server I guess it equates to being able to have two separate IP's supported by the one Linode. Is this possible?
17 Replies
You wrote:
However, I am uncertain whether I can also support a second website on my Linode server or whether I need to setup a second Linode for that. If I can have a second website running from my existing Linode server I guess it equates to being able to have two separate IP's supported by the one Linode. Is this possible?
This is absolutely possible. More than that, it's the norm for web servers…not the exception. Your only constraint will be system resources (usage of which is going to be highly-dependent on traffic patterns, configuration, etc).
I have two completely unrelated websites on my Linode. You only need one IP address. All you do is set up multiple virtual hosts (and the DNS info for each domain) and let the web server do all the work of figuring out which request goes to which virtual host.
Here's a (mostly) distro-agnostic tutorial about how to do this with apache2:
https://www.howtogeek.com/devops/how-to-host-multiple-websites-with-one-apache-server/
-- sw
I run 10 websites on the $40/mo. VPS. I could easily run 500 if I wanted as mine are plain HTML and Javascript and not bloated CMS… similar to this: https://radioqsl.com/
Thanks for the feedback. I'm not sure where the webserver configuration is on an odoo site (Apache or something else?). Will have to do some research I guess (unless it is setup right within odoo).
Hello again, been doing more research on this. So, setting up virtual hosts was suggested (and evidently do by way of the web server). I have also had someone from the odoo community suggest reverse proxies (also evidently setup by way of the web server). Are these options essentially the same or are they somehow different. Also, how/where do i get into web server configuration? When i setup my odoo site on linode it was an odoo package that was installed - I have idea what the web server is that odoo uses (is it just part of odoo) and how would i get to it?
If you Odoo system runs on a stock Linode distro, the apache2 configuration would be in /etc/apache2. The enabled virtual hosts will be in /etc/apache2/sites-enabled. The files here will all be symlinks to files in /etc/apache2/sites-available.
You'll want to modify the files in /etc/apache2/sites-available.
Are these options essentially the same or are they somehow different.
They are very different. IMHO, reverse proxies would be overkill for what you want to do. See:
-- sw
The odoo installation on linode was done by way of marketplace. I didn't setup server, db, web server etc individually. When connecting to the command line of the server an /etc/apache2 directory does not exist.
Well, the marketplace app you used chose not to follow the conventions about where things meet to go. That’s too bad (for you mostly)…. That’s the price you pay for “simplicity”.
I don’t know anything about the marketplace app, odoo or even the distro you have. I’m afraid I can’t help you any more.
— sw
Thanks for you assistance. So I may be somewhat screwed. I will endeavour to get linode people to tell me what their odoo markeplace package has done and where it has put things.
Well, I just discovered this:
from apachectl help:
-t -D DUMP_VHOSTS : show parsed vhost settings
The information provided by -D DUMP_VHOST
is what you want. You don't appear to need to be root to do this. Assuming your marketplace thing installed a more-or-less standard distro, apachectl should be located at /sbin/apachectl.
So
apachectl -t -D DUMP_VHOSTS
should show you what you need. Here's the important info from my system (suitably disguised):
stevewi:~ $ apachectl -t -D DUMP_VHOSTS
VirtualHost configuration:
*:80 localhost (/the/path/to/sites-enabled/certbot.conf:1)
*:443 is a NameVirtualHost
default server mydomain.com (/the/path/to/sites-enabled/ical.conf:5)
port 443 namevhost mydomain.com (/the/path/to/sites-enabled/ical.conf:5)
port 443 namevhost rspamd.mydomain.com (/the/path/to/sites-enabled/rspamd.conf:5)
However, don't be surprised if the marketplace thing just modified the main apache2 config file…and you don't have any virtual hosts at all. In that case, you're probably in for some surgery you're maybe not prepared to do. Unfortunately, apachectl does not give you the path to the main apache2 config file (for security reasons)…so none of this may help you much.
I will endeavour to get linode people to tell me what their odoo markeplace package has done and where it has put things.
Since your problem is "app-related" and not "infrastructure-related" I would not expect them to answer your question. I haven't the faintest idea how much vetting these "marketplace" submissions get. It wouldn’t surprise me that, since it's unlikely that Linode developed the marketplace package, the answer is little to none.
A cautionary tale I'm sure…
-- sw
You can check out the script that installed Odoo from the Marketplace for yourself here. If you hover on the Deploy This App button on the Odoo Marketplace App Page you will see the StackScript ID number in the URL at the bottom of the page.
Based on the info there, you can see the Odoo application is running in a Docker container and reverse proxied using Nginx. For more information on how the installation process works you can check out the Official Odoo Docker Image page.
With this info in mind, you may want to consider running your 2nd site in another Docker container on your instance. If you want to run a WordPress site for example, you can follow the instructions in the Linode Wordpress with Docker guide or the Sample Setup from Docker. You can find other Docker Images on the Docker Hub. After the container is up and running you'll need to Configure Nginx as a reverse proxy to serve them to the internet.
I think you can also manually configure Nginx to serve a website while also running a Docker container, although, I've never done it so I'm not 100% sure.
Thank you both for all the advice. Firstly, i cannot see apachectl on the server so I guess that isn't the road to go down. It looks like as per the last note here that it is probably using nginx. I am getting out of my comfort zone on this stuff (actually have been for a while).I will have a look at the info and links you provided.
Also, with Odoo, you have the option right within Odoo to create a second website (which I have done). And, your websites can share pages if desired (which I have also setup). My first website is live and the other one not yet. Within the Odoo application I can go back and forth between each website (but again only the first one is live online). Also, within the Odoo website setup you can if you wish specify a domain name for each site (and the note there says 'display this website when users visit this domain'). So I am now wondering if it is possible that this is all that is required - put the domain name in for this second site and odoo does behind the scenes what it must do with virtual hosts or whatever. Maybe that is my next step - purchase the second domain name, point it to my linode IP and enter this domain name into this field.
It looks like as per the last note here that it is probably using nginx.
You can do
ps -aux | grep nginx
to confirm this. You will see results if there are processes with the word nginx in the name.
-- sw
yes, with than command I can see that it is nginx. Anyways, what i did do was purchase the new domain name (with namecheap) and set it up over on namecheap to the linode name servers (ns1.linode.com, ns2.linode.com etc). I was thinking that i would be also noting the IP over at namecheap but I guess not. Rather i need to note the new domain name over on my linode server somewhere so that the two can link up. I went over to linode and listed this new site name on my linode domain list (put it in as secondary - I'm assuming that would be correct). I wondered if Odoo could then figure things out and call up the new website when I browse to the new domain name - nope didn't work. Maybe this second/new domain should be set as primary as well?
nginx has the concept of virtual hosts as well. None of what you’re trying to do involves the way odoo works. This is a web server configuration issue.
I’m not going to be much further help…I don’t use nginx.
Thank you for your suggestions. They are helping me to zero in on possible solution. I have made a few adjustments and also came across some odoo documentation that indicates the need to also do the following:
"Create an extra Nginx server block in which you set the server_name that you’ve set in the Website domain field".
Any idea as to where I would create an extra server block?
Any idea as to where I would create an extra server block?
In the nginx configuration… A "server block" in nginx-speak is the same as a virtual host in apache2.
-- sw
Update & Question…
Thanks to comments and suggestions that were left here I and done a fair bit of ongoing trial/error and think I am getting closer to having the two different domain names setup to operate on Odoo and the Nginx web server. In particular I have two related websites (SiteCAN and SiteUSA). I have messed around with Nginx configuration files quite a bit and have been able to make both sites (which were developed in Odoo) available. I do only have a partial understand as to how/why if more or less works (as it has been largely a trial/error setup). I also have managed to get ssl setup for both sites (which is great).
Anyways, at the moment accessing SiteCAN.ca works well. If you go to the browser and enter either SiteCAN.ca or www.SiteCAN.ca you bring up the site. However, SiteUSA.net doesn't work quite as smoothly. In particular, if you go to the brower and enter www.SiteUSA.net it works fine. However, if you only enter SiteUSA.net the browser will bring up the SiteCAN.ca site. While on other browsers it brings up the 404 not found page from Nginx.
I know I am asking a lot, however, if anyone has any suggestions where/how might look to resolve this I would be very grateful for any direction you might have to offer. Thank you.