在Ubuntu上使用Nginx启用SSL,你需要遵循以下步骤:
sudo apt update
sudo apt install certbot python3-certbot-nginx
yourdomain.com替换为你的域名:sudo certbot --nginx -d yourdomain.com
Certbot将自动配置Nginx并创建一个新的SSL证书。在过程中,它可能会要求你输入电子邮件地址、同意服务条款并设置证书的存储位置。
sudo nginx -t # 检查配置文件是否有语法错误
sudo systemctl reload nginx # 重载Nginx配置
sudo systemctl enable certbot.timer
https://yourdomain.com,确保SSL证书已正确安装并且网站可以通过HTTPS访问。现在,你的Ubuntu服务器上的Nginx已经启用了SSL,你的网站将通过HTTPS提供服务。