Question

Trying to configure a Ghost subdomain; what's wrong here?

So, I’ve got nginx up and running just fine, serving the main static site like I want it to. I’ve also got Ghost running just fine; if I plug in my site’s address and append :2368, I can look at the blog right now. Here’s how my zone file looks:

$ORIGIN landermkerbey.com.
$TTL 1800
landermkerbey.com. IN SOA ns1.digitalocean.com. hostmaster.landermkerbey.com. 1430683439 10800 3600 604800 1800
landermkerbey.com. 1800 IN A 162.243.45.221
landermkerbey.com. 1800 IN NS ns1.digitalocean.com.
landermkerbey.com. 1800 IN NS ns2.digitalocean.com.
landermkerbey.com. 1800 IN NS ns3.digitalocean.com.
*.landermkerbey.com. 1800 IN CNAME landermkerbey.com.
blog.landermkerbey.com. 1800 IN A 162.243.45.221

I have one nginx/sites-available file for both the main site and the blog, both of which have symbolic links in the sites-enabled directory. The one for the blog looks like this:

server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;

server_name blog.landermkerbey.com; 
access_log /var/log/nginx/ghost.log


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;
} 

It also has a location /doc and location /images section, though those are unedited from the default file provided by nginx.

As for my config.js file, I went ahead and modified the production section:

// ### Production
// When running Ghost in the wild, use the production environment
// Configure your URL and mail settings here
production: {
url: 'http://blog.landermkerbey.com',
mail: {},
database: {
client: 'sqlite3',
connection: {
filename: path.join(__dirname, '/content/data/ghost.db')
},
debug: false
},
server: {
// Host to be passed to node's net.Server#listen()
host: '127.0.0.1',
// Port to be passed to node's net.Server#listen(), for iisnode set this to process.env.PORT
port: '2368'
}
},

So, what am I doing wrong? Should the blog and main site be contained in a single sites-available file?


Submit an answer

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!

Sign In or Sign Up to Answer

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.

The Wildcard DNS Entry should be an A entry, not a CNAME.

*.landermkerbey.com. 1800 IN CNAME landermkerbey.com.

should be:

*.landermkerbey.com. 1800 IN A landermkerbey.com.

The same would apply if you were adding a single sub-domain, without the Wildcard Entry:

mysub.landermkerbey.com. 1800 IN A landermkerbey.com.

If you’re using DigitalOcean to manage your DNS, then you’d simply enter the following in to the form:

Enter Name: *
Enter IP Address: [DROPLET-IP]

and then click submit. You’ll want to remove the CNAME with the Wildcard.

As an A entry, all attempts to access sub.yourdomain.ext will be sent to yourdomain.ext unless there’s a valid server block defined and included when NGINX (re)starts. This includes www, thus, there’s no real need to have a CNAME for www either (and you don’t, just pointing it out).