DEV Community

2 1

NGINX Set Let's Encrypt

set Https บน nginx ด้วย Let's Encrypt


How to start

- Step 1 install certbot

$ sudo add-apt-repository ppa:certbot/certbot

- Step 2 install Certbot’s Nginx package

$ sudo apt install python-certbot-nginx

- Step 3 edit config on Site Available

$ sudo nano /etc/nginx/sites-available/default

/etc/nginx/sites-available/default

...
server_name example.com www.example.com;
...

- Step 4 restart nginx

$ sudo systemctl restart nginx

- Step 5 certbot

sudo certbot --nginx -d <example.com> -d www.<example.com>

output and select 2

Output
Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
-------------------------------------------------------------------------------
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
-------------------------------------------------------------------------------
Select the appropriate number [1-2] then [enter] (press 'c' to cancel):

- open https with https://example.com

Heroku

This site is built on Heroku

Join the ranks of developers at Salesforce, Airbase, DEV, and more who deploy their mission critical applications on Heroku. Sign up today and launch your first app!

Get Started

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs