# Ghost www redirecting to nginx index.html DigitalOcean

**URL:** <https://forum.ghost.org/t/ghost-www-redirecting-to-nginx-index-html-digitalocean/2214>\
**Category:** Developer help\
**Created:** [July 31, 2018, 10:12pm UTC](https://forum.ghost.org/t/ghost-www-redirecting-to-nginx-index-html-digitalocean/2214 "2018-07-31T22:12:57Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![denimandleather](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/denimandleather/32/1104_2.png) [@denimandleather](https://forum.ghost.org/u/denimandleather)\
**Post date:** [July 31, 2018, 10:12pm UTC](https://forum.ghost.org/t/ghost-www-redirecting-to-nginx-index-html-digitalocean/2214/1 "2018-07-31T22:12:57Z")

</div>

Edit: Resolved

I installed Ghost via 1-click image on DigitalOcean. However after I followed instructions the site is not accessible from www subdomain, only [denimandleather.me](http://denimandleather.me)

It seems to redirect to var/www/html/index.html instead of Ghost.

I tried rebuilding 1-click image several times but got different errors. I also installed SSL using certbox.

I also tried not using certbox and using Ghost’s built in SSL setup but requests that were sent to http: instead of https: were not redirected and resulted in ghost not loading. Editing /var/www/ghost/config.production.json and forcing https caused [https://www.denimandleather.me](https://www.denimandleather.me) to produce an error (invalid SSL certificate).

Configuration files are:

etc/nginx/sites-available

Current configuration etc/nginx/sites-available/default lists the servers.

I used certbot to install SSL certificate, with /var/www/ghost/config.production.json forcing https.

I’d like all domains all to load the blog page properly instead of giving “Welcome to nginx!” message, and also always redirect to https and to make sure the SSL certificate is auto-renewed every 3 months.

Now it looks like both [denimandleather.me](http://denimandleather.me) and www subdomain to both display the nginx welcome page instead of Ghost.

Help!

Paul

---

<div class="post-metadata">

**Author:** ![vikaspotluri123](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/vikaspotluri123/32/24_2.png) [@vikaspotluri123](https://forum.ghost.org/u/vikaspotluri123)\
**Post date:** [July 31, 2018, 10:41pm UTC](https://forum.ghost.org/t/ghost-www-redirecting-to-nginx-index-html-digitalocean/2214/2 "2018-07-31T22:41:43Z")

</div>

Hey Paul!

In order to setup ssl with ghost, you need to configure your site to run with ssl -

`ghost config set url https://denimandleather.me`  
`ghost setup nginx` (it will ask if you want to set up ssl, and do it)

Check out [this section in the docs](https://docs.ghost.org/docs/cli-knowledge-base#section-ssl-for-additional-domains) for information regarding multiple domains

I know this doesn’t 100% answer your question, but it will hopefully push you in the right direction 😄

---

<div class="post-metadata">

**Author:** ![denimandleather](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/denimandleather/32/1104_2.png) [@denimandleather](https://forum.ghost.org/u/denimandleather)\
**Post date:** [July 31, 2018, 11:59pm UTC](https://forum.ghost.org/t/ghost-www-redirecting-to-nginx-index-html-digitalocean/2214/4 "2018-07-31T23:59:07Z")

</div>

Wow that fixed it, what a pain to resolve the common www. part of the name ;p

---

<div class="post-metadata">

**Author:** ![mds08011](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/mds08011/32/314_2.png) [@mds08011](https://forum.ghost.org/u/mds08011)\
**Post date:** [August 1, 2018, 3:53pm UTC](https://forum.ghost.org/t/ghost-www-redirecting-to-nginx-index-html-digitalocean/2214/5 "2018-08-01T15:53:44Z")

</div>

Thank you! This was also confusing me.

---

<div class="post-metadata">

**Author:** ![John](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/john/32/29288_2.png) [@John](https://forum.ghost.org/u/John)\
**Post date:** [August 2, 2018, 9:09pm UTC](https://forum.ghost.org/t/ghost-www-redirecting-to-nginx-index-html-digitalocean/2214/6 "2018-08-02T21:09:27Z")

</div>

@acburdine / @Aileen could we have Ghost-CLI just do this in the background? I can’t think of a case where you would ever _not_ want to just redirect the www or non-www version? 🤔

eg.

if using a domain which does-_not_ start with **www** :  
Automatically setup and redirect `www.domain.com => domain.com`

if using a domain which _does_ start **www** :  
Automatically setup and redirect `domain.com => www.domain.com`

Could potentially also add a line to the CLI output to indicate this has happened in the background?

---

<div class="post-metadata">

**Author:** ![afern247](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/afern247/32/10894_2.png) [@afern247](https://forum.ghost.org/u/afern247)\
**Post date:** [August 4, 2018, 6:29am UTC](https://forum.ghost.org/t/ghost-www-redirecting-to-nginx-index-html-digitalocean/2214/7 "2018-08-04T06:29:55Z")

</div>

I don’t know how those one click server work because I’ve never tried one, but if you have access to your server via root, I would use Certbot, I’m going to include below a guide from my blog that goes over how to have ssl on any website, not only ghost.

The method that @vikaspotluri123 mentioned is one way, I personally installed Cerbot and then configured the domain to have ssl, if you go to nginx, you’ll see the changes. After configured it can redirect all the http requests to https 🙂

I think that’s a cleaner way to set it up

[https://elkepon.com/how-to-set-up-lets-encrypt-with-nginx-server-blocks-on-ubuntu-16-04/](https://elkepon.com/how-to-set-up-lets-encrypt-with-nginx-server-blocks-on-ubuntu-16-04/)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/ghost2/original/2X/b/ba9ce5100b8bb264586f4f572545596b2ce3f081.png) [@system](https://forum.ghost.org/u/system)\
**Post date:** [August 18, 2018, 6:29am UTC](https://forum.ghost.org/t/ghost-www-redirecting-to-nginx-index-html-digitalocean/2214/8 "2018-08-18T06:29:57Z")

</div>

Closed on August 18, 2018, 6:29am UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.

---

<div class="post-metadata">

**Author:** ![acburdine](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/acburdine/32/4825_2.png) [@acburdine](https://forum.ghost.org/u/acburdine)\
**Post date:** [August 18, 2018, 9:43pm UTC](https://forum.ghost.org/t/ghost-www-redirecting-to-nginx-index-html-digitalocean/2214/9 "2018-08-18T21:43:22Z")

</div>

Sorry for the delayed response to this - definitely think it’s doable to automatically create that redirect.
