无法为 Ubuntu VPS NextJS 应用程序创建 SSL

无法为 Ubuntu VPS NextJS 应用程序创建 SSL

我正在尝试为托管在 Ubuntu VPS 上的网站获取 SSL。运行 sudo certbot --nginx -v 时收到以下错误

Certbot 无法验证某些域(验证器:nginx)。证书颁发机构报告了以下问题:域:webclass.in 类型:未经授权 详细信息:2a02:4780:11:1217:0:174f:b4a5:2:无效响应来自http://webclass.in/.well-known/acme-challenge/X2BsixJL7WqFEljetL-KJc7YMhTvqbaaWNDFl2R3ZlQ:404

领域:www.webclass.in 类型:未经授权 详细信息:2a02:4780:11:1217:0:174f:b4a5:2:无效响应来自http://www.webclass.in/.well-known/acme-challenge/HZmf5wd8t5F0zPN9-Xri3cdBpt2VkRMqydQuSbMB_Aw:404

提示:证书颁发机构无法验证 Certbot 所做的临时 nginx 配置更改。确保列出的域指向此 nginx 服务器,并且可从互联网访问。好心人,请帮帮我,我已经为此苦苦挣扎了 8 个多小时,不知道该怎么办。我在前端运行 NextJS 应用程序

这是我的 Nginx 配置 -

用户 www-data;worker_processes 自动;pid /run/nginx.pid;

events { worker_connections 768; # 如果需要,可以在这里添加其他事件相关配置 }

http { sendfile 开启; tcp_nopush 开启; tcp_nodelay 开启; keepalive_timeout 65; types_hash_max_size 2048; 包括 /etc/nginx/mime.types; default_type application/octet-stream;

server {
    listen 80;
    listen [::]:80;
    server_name webclass.in www.webclass.in;

    location / {
        proxy_pass http://localhost:3000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
  }

  # for letsencrypt
   location ~ /.well-known/acme-challenge/ {
     allow all;
   }


    # Additional configuration can be added here if needed

    access_log /var/log/nginx/access.log;  # Adjust the log path as needed
    error_log /var/log/nginx/error.log;    # Adjust the log path as needed
}

# Additional server blocks or configurations can be added here for other domains or applications

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;

}

相关内容