使用certbot启用https后出现问题

问题描述 投票:0回答:1

我已经在 VPS 中托管了我的 meern stack 项目。一切都很好,但在我使用 certbot 启用 ssl 后,它显示: enter image description here

这是我的配置文件:

server {
    server_name dmssilver6.com www.dmssilver6.com;
    root /root/silver6-frontend/dist;
    location / {
        try_files $uri $uri/ =404;
    }

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/dmssilver6.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/dmssilver6.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
    if ($host = www.dmssilver6.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    if ($host = dmssilver6.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

    return 404; # managed by Certbot




}
server {
    if ($host = www.dmssilver6.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    if ($host = dmssilver6.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    listen 80;
    server_name dmssilver6.com www.dmssilver6.com;
    return 404; # managed by Certbot




}

但是当我尝试重新启动 nginx 时,出现以下错误:

nginx:[emerg]绑定()到0.0.0.0:443失败(98:地址已在使用中)

我也有用于托管 API 的子域,两者都有相同的问题。没有 ssl,它工作正常。可能是什么问题?

express hosting vps certbot
1个回答
0
投票

这可能是由于其他进程使用了端口 443。

  1. 检查它是否被其他进程使用。

    sudo lsof -i:443

  2. 停止正在运行的进程

    sudo systemctl停止

  3. 重启NGINX

    sudo systemctl 重新启动 nginx

© www.soinside.com 2019 - 2024. All rights reserved.