-
-
Save mizanmahi/f3f932e3bea474100f7ddede11295581 to your computer and use it in GitHub Desktop.
AWS SSL configuration with nodejs, nginx and letsencrypt using certbot
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
1) Clone Repo | |
2) Install all module by `sudo npm install`. After installing all modules if u get any error run `npm rebuild` | |
2) Install pm2 by running `sudo npm i pm2 -g` | |
4) run via pm2 `pm2 start pm2-config.json` |
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
sudo apt update | |
sudo apt install software-properties-common | |
sudo add-apt-repository ppa:certbot/certbot | |
sudo apt-get install python-certbot-nginx |
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
sudo nano /etc/nginx/sites-available/yourdomain.com.conf | |
And copy the following | |
server { | |
listen 80; | |
server_name <YourDomain.com>; ##Change domain as u need | |
location / { | |
proxy_pass http://localhost:3005; ##Change your port as u need | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection 'upgrade'; | |
proxy_set_header Host $host; | |
proxy_cache_bypass $http_upgrade; | |
} | |
} | |
Follow the command | |
sudo nano /etc/nginx/nginx.conf | |
Change | |
inculde /etc/nginx/sites-enabled/*; | |
to | |
include /etc/nginx/sites-available/*; | |
Change example.com and <YourDomain.com> to your domain | |
Change proxy_pass http://localhost:3000/ to your desired port | |
Check nginx conf | |
sudo nginx -t | |
Restart nginx | |
sudo service nginx stop | |
sudo service nginx start |
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
sudo certbot --nginx | |
select your domain | |
redirect all routing |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment