Report this

What is the reason for this report?

Getting Ghost to recognize use of www sub-domain and no sub-domain

Posted on October 1, 2018

I’ve setup a new Ghost blog on Ubuntu 16.04 at pricelesspricing.com. That works fine. However, when I go to www.pricelesspricing.com I get a screen telling me to setup Ghost.

I currently have a CNAME record directing www.pricelesspricing.com to pricelesspricing.com I have an A record for pricelesspricing.com that directs it to by site IP

What I’ve tried:

  1. Add both domains to SSL using certbot
  2. Added both domains to Ghost config under server_name
  3. Restarted Ghost and NGINX
  4. NGINX and Ghost config now show: server_name pricelesspricing.com www.pricelesspricing.com

I’m stuck now and not sure what else to try. Can anyone help please?

Thanks.

JT



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.

Hello,

Based on the information you provided, it seems you’ve already done the required configurations. However, it’s possible that there might be a small issue in your Nginx configuration. Please follow these steps to ensure your Nginx configuration is set up correctly:

  1. Edit your Nginx configuration file for your Ghost blog (usually located at /etc/nginx/sites-available/pricelesspricing.com or /etc/nginx/conf.d/pricelesspricing.com):
  1. sudo nano /etc/nginx/sites-available/pricelesspricing.com
  1. Ensure that your server block has the correct server_name directive with both domain names:
server {
    listen 80;
    server_name pricelesspricing.com www.pricelesspricing.com;

    # Other configurations...
}
  1. Check your SSL configurations. If you’re using Certbot, it should have created a separate server block for SSL with both domain names as well:
server {
    listen 443 ssl http2;
    server_name pricelesspricing.com www.pricelesspricing.com;

    ssl_certificate /etc/letsencrypt/live/pricelesspricing.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/pricelesspricing.com/privkey.pem;

    # Other configurations...
}
  1. Test your Nginx configuration and restart Nginx:
  1. sudo nginx -t
  2. systemctl restart nginx
  1. Check your DNS settings and ensure that the CNAME record for www.pricelesspricing.com is pointing to pricelesspricing.com.

If you’ve followed these steps and still encounter the issue, there might be a problem with your Ghost configuration. In that case, edit the config.production.json file in your Ghost installation directory and ensure that the url field includes the primary domain without the www subdomain:

{
  "url": "https://pricelesspricing.com",
  "server": {
    "port": 2368,
    "host": "127.0.0.1"
  },
  // Other configurations...
}

After making changes to the Ghost configuration, restart the Ghost service:

cd /path/to/your/ghost/installation
ghost restart

Now, both pricelesspricing.com and www.pricelesspricing.com should serve the same content.

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.