Hi - I followed the below tutorial to the letter, and I’m having trouble getting multiple blogs working correctly:
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.
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.
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.
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.
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;
}
}
Hi, sorry pasted the server blocks into the answer field below instead of the comments so you probably haven’t seen them.
Also was doing some experimenting tonight. If I swap the ‘default server’ markers from the sites-available domain1.conf to domain2.conf, both URLs then point to the domain2 instance of Ghost.
Those are okay. How about server blocks in
sites-enabled
?Thanks, c&p below. Have only taken the production sections of the config.js files.
nginx.conf:
config.js - domain1:
config.js - domain2:
Post your nginx conf and config.js