Report this

What is the reason for this report?

Nginx server block works for one subdomain but not the other.

Posted on December 25, 2015

I am trying to install two instances of Ghost at two different subdomains: one.example.com, two.example.com. I followed this guide to setup multiple Ghost instances: https://www.digitalocean.com/community/tutorials/how-to-serve-multiple-ghost-blogs-on-one-vps-using-nginx-server-blocks

When I visit one.example.com, the blog loads. However, when I visit two.exmaple.com or www.example.com, I get the vanilla nginx page. Whether or not I have the server block for ghost two enabled, two.example.com goes to the nginx page.

I tried removing all server blocks from conf.d and sites-enabled. In this case, one.example.com gives me the Unable to Connect page on Firefox. the www and two subdomains still go to the nginx page.

My Zone file is:

example.com. 1800 IN A 0.0.0.0
www.example.com. 1800 IN CNAME example.com.
one.example.com. 1800 IN CNAME example.com.
two.example.com. 1800 IN CNAME example.com.

Furthermore, If the only file I have in sites-enabled is

server {
    listen 80;
    server_name two.example.com;

    location / {
        proxy_set_header HOST $http_host;
        proxy_pass http://127.0.0.1:2368;
        proxy_redirect off;
    }
}

then one.example.com will load ghost page, and two will load nginx page. In this case, the url in ghost/config.js is set to http://two.example.com and the port is set to 2368.

I’m using node v4.2.4 and nginx 1.4.6 on Ubuntu. I installed these manually following the tutorial, but I guess I missed something somewhere and I can’t figure out where.



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Problem solved. Firefox wasn’t refreshing the cache sometimes. I forced it to check for outdated cache every time the page loads.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.