Here are the steps to install Nginx with HTTP/2 support and configure Let’s Encrypt SSL:
- Install Nginx:
- Ubuntu/Debian:
sudo apt-get update && sudo apt-get install nginx
- CentOS/Fedora:
sudo yum install nginx
- Other platforms: see Nginx documentation.
- Ubuntu/Debian:
- 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;
...
}
- Edit Nginx configuration file, usually at
- 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.
- Ubuntu/Debian:
- 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.
- Start Nginx: