简体   繁体   中英

Setup SSL with vapor

I have a config like this

{
    "default": {
        "port": "443",
        "host": "example.com",
        "securityLayer": "tls",
        "tls": {
            "certificates": "files",
            "certificateFile": "/etc/letsencrypt/live/example.com/fullchain.pem",
            "privateKeyFile": "/etc/letsencrypt/live/example.com/privkey.pem"
        }
    }
}

On drop startup it prints out this console message:

No TLS signature supplied, defaulting to selfSigned.

Judging by the code that produces that error message it expects signature field in the config that would be either selfSigned , signedFile or signedDirectory

在此处输入图片说明

I have this files from let's encrypt :

  • cert.pem
  • chain.pem
  • fullchain.pem
  • privkey.pem

What do I do to resolve that error message?

This should fix problem

{
    "default": {
        "port": "443",
        "host": "example.com",
        "securityLayer": "tls",
        "tls": {
            "signature": "signedFile",
            "certificates": "files",
            "certificateFile": "/etc/letsencrypt/live/example.com/fullchain.pem",
            "privateKeyFile": "/etc/letsencrypt/live/example.com/privkey.pem"
        }
    }
}

Vapor don't recommend to use SSL cert directly in Vapor.

You should consider use ngix or apache as SSL-proxy: https://docs.vapor.codes/2.0/deploy/nginx/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM