# Website does not forward to https (part2)

**URL:** https://meta.discourse.org/t/website-does-not-forward-to-https-part2/157713
**Category:** Self-hosting
**Created:** [July 14, 2020, 3:42pm UTC](https://meta.discourse.org/t/website-does-not-forward-to-https-part2/157713 "2020-07-14T15:42:19Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![pr0cesor](https://avatars.discourse-cdn.com/v4/letter/p/977dab/32.png) [@pr0cesor](https://meta.discourse.org/u/pr0cesor)
#### Post date: [July 14, 2020, 3:42pm UTC](https://meta.discourse.org/t/website-does-not-forward-to-https-part2/157713/1 "2020-07-14T15:42:19Z")

</div>

Hello it’s me again ^^.

I have a slight problem that I believe I had before but it could be now something else.

The problem is the following:

- if you open [cp2077.eu](http://cp2077.eu) on browser, then the page says its “under maintenance” which is a template of mine of course and it’s not secure.

- but if you open [https://cp2077.eu](https://cp2077.eu) , then the discourse forum appears and the website looks secure with SSL.

My guess is that my nginx file is not taking account redirecting page to https. Here is my file, I have checked but I don’t know where the problem is, it looks fine (I think it looks fine) but maybe someone with more knowledge can help me sort this issue out? I would appreciate:

```
server {

    listen 80;
    listen [::]:80;
    server_name www.cp2077.eu;
    return 301 https://cp2077.eu$request_uri;
}

server {

    listen 443 ssl;
    listen [::]:443 ssl;
    server_name www.cp2077.eu;
    ssl_certificate /etc/letsencrypt/live/cp2077.eu/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/cp2077.eu/privkey.pem;
    return 301 https://cp2077.eu$request_uri;
}

server {

    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name cp2077.eu;

    ssl on;
    ssl_certificate /etc/letsencrypt/live/cp2077.eu/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/cp2077.eu/privkey.pem;

    http2_idle_timeout 5m; # up from 3m default

    location / {
        proxy_pass http://unix:/var/discourse/shared/standalone/nginx.http.sock;
        proxy_set_header Host $http_host;
        proxy_http_version 1.1;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto https;
        proxy_set_header X-Real-IP $remote_addr;

    }

}

```

Any clue what could I change here to resolve it?

---

<div class="post-metadata">

### Author: ![Arkshine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arkshine/32/298682_2.png) [@Arkshine](https://meta.discourse.org/u/Arkshine)
#### Post date: [July 14, 2020, 4:20pm UTC](https://meta.discourse.org/t/website-does-not-forward-to-https-part2/157713/2 "2020-07-14T16:20:03Z")

</div>

> [@pr0cesor](#):
>
> `server_name www.cp2077.eu;`

You allow only `ẁww.`.

---

<div class="post-metadata">

### Author: ![pr0cesor](https://avatars.discourse-cdn.com/v4/letter/p/977dab/32.png) [@pr0cesor](https://meta.discourse.org/u/pr0cesor)
#### Post date: [July 14, 2020, 4:22pm UTC](https://meta.discourse.org/t/website-does-not-forward-to-https-part2/157713/3 "2020-07-14T16:22:42Z")

</div>

How can I redirect www and [cp2077.eu](http://cp2077.eu) to be redirected to https?

---

<div class="post-metadata">

### Author: ![Arkshine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arkshine/32/298682_2.png) [@Arkshine](https://meta.discourse.org/u/Arkshine)
#### Post date: [July 14, 2020, 4:52pm UTC](https://meta.discourse.org/t/website-does-not-forward-to-https-part2/157713/4 "2020-07-14T16:52:33Z")

</div>

Try adding the domain.

`server_name cp2077.eu www.cp2077.eu;`

---

<div class="post-metadata">

### Author: ![pr0cesor](https://avatars.discourse-cdn.com/v4/letter/p/977dab/32.png) [@pr0cesor](https://meta.discourse.org/u/pr0cesor)
#### Post date: [July 14, 2020, 5:08pm UTC](https://meta.discourse.org/t/website-does-not-forward-to-https-part2/157713/5 "2020-07-14T17:08:18Z")

</div>

Tried that before posting, it throws me the following error when running command: nginx -t

```
nginx: [warn] conflicting server name "cp2077.eu" on 0.0.0.0:443, ignored
nginx: [warn] conflicting server name "cp2077.eu" on [::]:443, ignored

```

---

<div class="post-metadata">

### Author: ![Arkshine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arkshine/32/298682_2.png) [@Arkshine](https://meta.discourse.org/u/Arkshine)
#### Post date: [July 14, 2020, 5:15pm UTC](https://meta.discourse.org/t/website-does-not-forward-to-https-part2/157713/6 "2020-07-14T17:15:39Z")

</div>

Did you add it _only_ in the first `server {}` (port 80)?

---

<div class="post-metadata">

### Author: ![pr0cesor](https://avatars.discourse-cdn.com/v4/letter/p/977dab/32.png) [@pr0cesor](https://meta.discourse.org/u/pr0cesor)
#### Post date: [July 14, 2020, 5:42pm UTC](https://meta.discourse.org/t/website-does-not-forward-to-https-part2/157713/7 "2020-07-14T17:42:07Z")

</div>

I added it on both 80 and 443

—Edit.

I just put it on 80 and looks like its working. However now it says that Connection not secure (parts of this page are not secure, such as images)\_

---

<div class="post-metadata">

### Author: ![Arkshine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arkshine/32/298682_2.png) [@Arkshine](https://meta.discourse.org/u/Arkshine)
#### Post date: [July 14, 2020, 5:55pm UTC](https://meta.discourse.org/t/website-does-not-forward-to-https-part2/157713/8 "2020-07-14T17:55:51Z")

</div>

You should enable `force https` in discourse settings.

---

<div class="post-metadata">

### Author: ![pr0cesor](https://avatars.discourse-cdn.com/v4/letter/p/977dab/32.png) [@pr0cesor](https://meta.discourse.org/u/pr0cesor)
#### Post date: [July 14, 2020, 5:59pm UTC](https://meta.discourse.org/t/website-does-not-forward-to-https-part2/157713/9 "2020-07-14T17:59:12Z")

</div>

I will try that. Thank you very much Arkshine

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [August 13, 2020, 5:59pm UTC](https://meta.discourse.org/t/website-does-not-forward-to-https-part2/157713/10 "2020-08-13T17:59:29Z")

</div>

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