Last active
November 21, 2020 18:57
-
-
Save srtvprateek/58d87cac7aaae483d180f92aea04acbc to your computer and use it in GitHub Desktop.
Setting SSL with LetsEncrypt & KONG, refer https://gist.github.com/srtvprateek/417ed0b2e1790389f1fdfe12dcebcccf before this
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
### Please refer https://gist.github.com/srtvprateek/417ed0b2e1790389f1fdfe12dcebcccf | |
### to setup node and KONG before proceeding | |
## install GIT | |
sudo apt update && sudo apt upgrade | |
sudo apt-get install git | |
## download LetsEncrypt | |
sudo git clone https://github.com/letsencrypt/letsencrypt | |
## creating SSL certificate | |
sudo kong stop # you need to stop KONG server here, so that SSL can be validated | |
sudo -H ./letsencrypt-auto certonly --standalone --renew-by-default -d EXAMPLE.COM | |
## setting up KONG ssl | |
sudo bash -c "echo -e ‘\nssl = on\nssl_cert = /etc/letsencrypt/live/EXAMPLE.COM/fullchain.pem \nssl_cert_key = /etc/letsencrypt/live/EXAMPLE.COM/privkey.pem' >> /etc/kong/kong_custom.conf" | |
sudo vim /etc/kong/kong.conf | |
# copy following code to /etc/kong/kong.conf | |
proxy_listen = 0.0.0.0:80, 0.0.0.0:443 ssl | |
sudo kong start -c /etc/kong/kong_custom.conf # start KONG server | |
## Adding SSL certificates to KONG | |
sudo curl -i -X POST http://localhost:8001/certificates \ | |
-F "cert=@/etc/letsencrypt/live/api.alkile.co/fullchain.pem" \ | |
-F "key=@/etc/letsencrypt/live/api.alkile.co/privkey.pem" \ | |
-F "snis=EXAMPLE.COM" | |
### 🎉 You are all set, try https://example.com to verify. 🎉 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment