Report this

What is the reason for this report?

Tutorial Issue: Multiple Ghost blogs on one VPS

Posted on January 6, 2016

Hi - I followed the below tutorial to the letter, and I’m having trouble getting multiple blogs working correctly:

https://www.digitalocean.com/community/tutorials/how-to-serve-multiple-ghost-blogs-on-one-vps-using-nginx-server-blocks

When I reached the end both domains were pointing at the same instance of Ghost (I’d update the content on the domain1 blog and it would also appear on domain2. I’d try to log in on domain2 and it would throw an error telling me to log in from the URL specified in the config.js file).

I’ve gone through the comments and made a couple of other minor changes based on issues other users have had. I know sometimes the DO image gets updated and renders bits of the tutorial slightly out of date.

  • Removed ‘default server’ from the domain2 config files to prevent the ‘duplicate default servers’ error.
  • Set up files in ‘/etc/nginx/sites-enabled’ as symlinks to the config files in ‘/etc/nginx/sites-available’

There seem to be a few others in the comments on the tutorial having this same issue, but no answers in the thread. Any idea whether something has changed in the image that is causing this? Or have I messed up something during set-up?

Thanks.



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.

Files in sites-enabled are symlinks to sites-available, so these are from my sites-available.

domain1.conf

server {    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;
 
    server_name blog.helloimandrew.co.uk; # Replace with your domain
 
    root /usr/share/nginx/html;
    index index.html index.htm;
 
    client_max_body_size 10G;
 
    location / {
        proxy_pass http://localhost:2368;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_buffering off;
    }
}

domain2.conf

server {    listen 80; # default_server;
listen [::]:80; # default_server ipv6only=on;
 
    server_name stuffandnonsense.me.uk; # Replace with your domain
 
    root /usr/share/nginx/html;
    index index.html index.htm;
 
    client_max_body_size 10G;
 
    location / {
        proxy_pass http://localhost:2777;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_buffering off;
    }
}

Really simple solution. server_name in the /etc/nginx/sites-available folder needed to include the ‘www.’ (which it doesn’t in the tutorial).

Without that requests were being directed to the server’s IP address and, because none of them matched any domains in the sites-available folder, were being passed to the default.

Many thanks for your time though! It’s been a learning curve.

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.