ProByte.org Linux tutorials

How to install Nginx with HTTP/2 support with letsencrypt

Here are the steps to install Nginx with HTTP/2 support and configure Let’s Encrypt SSL:

  1. Install Nginx:
    • Ubuntu/Debian: sudo apt-get update && sudo apt-get install nginx
    • CentOS/Fedora: sudo yum install nginx
    • Other platforms: see Nginx documentation.
  2. Enable HTTP/2:
    • Edit Nginx configuration file, usually at /etc/nginx/nginx.conf
    • Add the following to the http block:
    server {
    listen 443 ssl http2;
    ...
    }
  3. Install certbot and configure Let’s Encrypt SSL:
    • Ubuntu/Debian: sudo apt-get update && sudo apt-get install certbot python-certbot-nginx
    • CentOS/Fedora: sudo yum install certbot && sudo yum install certbot-nginx
    • Other platforms: see certbot documentation.
    • Obtain SSL certificate: sudo certbot --nginx
    • Follow the on-screen instructions to complete the process.
  4. Verify installation and configuration:
    • Start Nginx: sudo service nginx start
    • Check Nginx status: sudo nginx -t
    • Access your website using HTTPS and check the SSL certificate.

Leave a Reply

Your email address will not be published. Required fields are marked *