# Facing issue while Setting up Grafana from HTTP to HTTPS

**URL:** <https://community.grafana.com/t/facing-issue-while-setting-up-grafana-from-http-to-https/60593>\
**Category:** Configuration\
**Tags:** configuration, config-help\
**Created:** [February 10, 2022, 5:10pm UTC](https://community.grafana.com/t/facing-issue-while-setting-up-grafana-from-http-to-https/60593 "2022-02-10T17:10:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gopal18k20](https://avatars.discourse-cdn.com/v4/letter/g/977dab/32.png) [@gopal18k20](https://community.grafana.com/u/gopal18k20)\
**Post date:** [February 10, 2022, 5:10pm UTC](https://community.grafana.com/t/facing-issue-while-setting-up-grafana-from-http-to-https/60593/1 "2022-02-10T17:10:06Z")

</div>

I have successfully running a grafana instance on my server. It runs on `http` without a problem. Now I want to switch from `http` to `https` . My `grafana.ini` is shown bellow:

[server]

# Protocol (http, https, h2, socket)

protocol = https

# The http port to use

http\_port = 8080

# The public facing domain name used to access grafana from a browser

domain = [mydomain.com](http://mydomain.com)

# Redirect to correct domain if host header does not match domain

# Prevents DNS rebinding attacks

enforce\_domain = false

# The full public facing url you use in browser, used for redirects and emails

# If you use reverse proxy and sub path specify full url (with sub path)

root\_url = %(protocol)s://%(domain)s:%(http\_port)s/

# Serve Grafana from subpath specified in `root_url` setting. By default it is set to `false` for compatibility reasons.

serve\_from\_sub\_path = false

# Log web requests

router\_logging = false

# the path relative working path

static\_root\_path = public

# enable gzip

enable\_gzip = false

# https certs & key file

cert\_file =“C:\Program Files\GrafanaLabs\grafana\wildcard.cer”  
cert\_key =“C:\Program Files\GrafanaLabs\grafana\wildcard.key”

**I am getting the below error while starting the grafana service**

t=2022-02-10T17:04:19+0000 lvl=info msg=“HTTP Server Listen” logger=http.server address=[::]:8080 protocol=https subUrl= socket=  
t=2022-02-10T17:04:19+0000 lvl=eror msg=“Stopped HTTPServer” logger=server reason=“tls: found a certificate rather than a key in the PEM for the private key”  
t=2022-02-10T17:04:19+0000 lvl=info msg=“Stopped Stream Manager”  
t=2022-02-10T17:04:20+0000 lvl=eror msg=“A service failed” logger=server err=“tls: found a certificate rather than a key in the PEM for the private key”  
t=2022-02-10T17:04:20+0000 lvl=eror msg=“Server shutdown” logger=server reason=“tls: found a certificate rather than a key in the PEM for the private key”

Can some one help me on this.

---

<div class="post-metadata">

**Author:** ![codlord](https://avatars.discourse-cdn.com/v4/letter/c/b5ac83/32.png) [@codlord](https://community.grafana.com/u/codlord)\
**Post date:** [February 10, 2022, 5:55pm UTC](https://community.grafana.com/t/facing-issue-while-setting-up-grafana-from-http-to-https/60593/2 "2022-02-10T17:55:15Z")

</div>

Have you generated the .cer and .key files yourself for a self-signed certificate or has some certificate authority supplied the files?

If you generated them yourself let us know exactly how.

If you look at the files does the .key file look like a key file and the .cer file look like a certificate file? e.g. in my case the .key file starts with:  
-----BEGIN PRIVATE KEY-----  
and the .cer file starts with:  
-----BEGIN CERTIFICATE-----

---

<div class="post-metadata">

**Author:** ![gopal18k20](https://avatars.discourse-cdn.com/v4/letter/g/977dab/32.png) [@gopal18k20](https://community.grafana.com/u/gopal18k20)\
**Post date:** [February 15, 2022, 5:28am UTC](https://community.grafana.com/t/facing-issue-while-setting-up-grafana-from-http-to-https/60593/3 "2022-02-15T05:28:58Z")

</div>

Created file with self- signed certificate only.

But when i Open the Key file and cer file

Both started with -----BEGIN CERTIFICATE-----
