Hi,
I am trying to install Ghost on my server, which is already running an express app with nginx. I have been trying to find some ways through but there have not been any effective solutions yet.
I’d really appreciate any help or just hint is also nice.
Addition: I’m working on an Oracle VM, ubuntu 20.04 LTS. And yes, the express app use port 80.
Clarification: the express app is serving as www.nhonho.tech , I want to have Ghost up at blog.nhonho.tech or www.nhonho.tech/blog . I also use Cloudflare as dns for my domain.
Update: I have installed Ghost on blog.nhonho.tech, but now Ghost also goes to nhonho.tech. How can I advoid that?
Update 2: If I access the web page by IP, it shows the express app, which is supposed to be at nhonho.tech
You can install ghost normally & it wont affect your current node web-apps. Ghost uses port 2368 Just make sure the port is not being used with another process.
Nginx server block seems fine but what I am suspecting both are in the same config file. Did you create a separate config file for your ghost instance ? If not then follow below:
Main site nhonho.tech is now good, except that Ghost site blog.nhonho.tech is now nowhere.
Also, when I run nginx -t, it returned:
root@localhost:/etc/nginx/sites-enabled# nginx -t
nginx: [warn] conflicting server name "blog.nhonho.tech" on 0.0.0.0:443, ignored
nginx: [warn] conflicting server name "blog.nhonho.tech" on [::]:443, ignored
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
I reinstalled nginx and changed Ghost from https to http, I’ll let the encrypt to Cloudflare.
The web seems to run fine now.
I think the problem is the different protocols used by two app, express use http while Ghost use https. Now they both use http and Cloudflare will take care of the rest.
It is possible to have multiple HTTPS sites on your web-server - it’s almost all down to your NGINX config. It’s also easy to mix and match HTTP and HTTPS. There is lots of NGINX help available via Google.
From the comments above it looks like you had both old and new config setup at the same time in the /etc/nginx/sites-enabled folder - this is why NGINX complained about duplicate servers.
HTTPS is important as it lets your readers verify that they have connected to your actual site, and not to another server pretending to be you. It also protects your Ghost username/password when you login to your Admin pages.
You should be aware that if you connect via an IP to your HTTPS server, NGINX will choose the FIRST server in /etc/nginx/sites-enabled/’ that is listening on 443 - so you can manage this using careful naming of the links in this folder - that’s why lots of folks use link-names like 00_default, 10_nhonho.tech, 20_blog-nhonho.tech etc.
you could try and create a new server context in your nginx config that listens on another port, such as 8443. In it, you can use the same location config as above.
Next, you can make your cloudflare domain point to port 8443 instead of the https default of 443. The IP would look something like this: