![Nginx 捕获的正则表达式以后不能重新用于包含吗?](https://linux22.com/image/753527/Nginx%20%E6%8D%95%E8%8E%B7%E7%9A%84%E6%AD%A3%E5%88%99%E8%A1%A8%E8%BE%BE%E5%BC%8F%E4%BB%A5%E5%90%8E%E4%B8%8D%E8%83%BD%E9%87%8D%E6%96%B0%E7%94%A8%E4%BA%8E%E5%8C%85%E5%90%AB%E5%90%97%EF%BC%9F.png)
我像这样捕获服务器名称:
server_name ~^(?<account>.+)\.myapp\.io$;
稍后我尝试在同一个文件上使用它,例如:
include $account.conf;
但它返回:
nginx: [emerg] open() "/etc/nginx/$account.conf" failed (2: No such file or directory)
当然,该文件是存在的。
如果我在其他地方使用它,它会起作用,例如:
access_log /var/log/nginx/$account-access.log;