web服务器https访问

web服务器https访问

ai Lv2

安装Let“s Encrypt证书

使网站可以使用https访问

1.安装Certbot

1
2
3
4
sudo apt update
sudo apt install certbot python3-certbot-nginx -y # 如果使用 Nginx
# 或
sudo apt install certbot python3-certbot-apache -y # 如果使用 Apache

2.获取SSL证书

方式一、自动获取

1
2
3
sudo certbot --nginx  # 如果是 Nginx
# 或
sudo certbot --apache # 如果是 Apache

方式二、手动获取

1
sudo certbot certonly --standalone -d twikoo.icsteam.cn

3.配置web服务器

nginx站点文件会自动添加相关配置文件

1
2
3
4
location /images/ {
# 允许访问图片目录
autoindex on; # 可选:开启目录列表(类似文件浏览器)
}

在目录下新增 autoindex on;开启目录列表(类似文件浏览器)

  • 标题: web服务器https访问
  • 作者: ai
  • 创建于 : 2025-07-16 21:00:51
  • 更新于 : 2025-07-25 13:39:47
  • 链接: https://blog.icsteam.cn/2025/07/16/101_web_https/
  • 版权声明: 本文章采用 CC BY-NC-SA 4.0 进行许可。
评论