server { ... set $ssl_root /etc/letsencrypt; set $domain a.com; ssl_certificate $ssl_root/$domain.rsa.pem; ssl_certificate_key $ssl_root/$domain.rsa.key; ... } 有关配置如上,我想达到的效果就是调用/etc/letsencrypt/下的有关证书文件a.com.rsa.pem以及a.com.rsa.key。但是运行 nginx 后报错信息如下:
nginx: [emerg] BIO_new_file("/usr/local/nginx/conf/$ssl_root/$domain.rsa.pem") failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen('/usr/local/nginx/conf/$ssl_root/$domain.rsa.pem','r') error:2006D080:BIO routines:BIO_new_file:no such file) 从报错信息中来看,nginx 并没有解析配置文件中设置好的变量,而是将它们作为纯字符串。我并没有在编译时加上--without-http_rewrite_module参数,但 set 指令似乎没有正常工作,请问可能有哪些问题?多谢各位大佬
编译参数如下:
./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-http_v2_module --with-openssl=../openssl-${OPENSSL_VER} --with-openssl-opt='enable-tls1_3' --add-module=../nginx-ct PS:有关文件的确存在
