是不是不能在Nginx中使用变量保存文件路径?

server{
        set $certs "/home/test/.letsencrypt/certs";
        listen 443 ssl http2 default_server;
        server_name  test.test.moe; # 域名
        ssl on;
        ssl_certificate ${certs}/test.chained.crt;

用了就会报错的样子

首先,不建议这样用变量:

其次,你把这一行

ssl_certificate ${certs}/test.chained.crt;

换成这一行试试

ssl_certificate $certs/test.chained.crt;