【发布时间】:2022-01-17 05:10:45
【问题描述】:
我在ASP.NET MVC Core 3.1 C# 中有一个站点,在Debian 上运行,Apache 2 通过ProxyPass 和ProxyReverse 以及一个功能域和 SSL Let's Encrypt 证书在site-com.conf 文件中具有以下配置:
ProxyPreserveHost On
ProxyPass / https://localhost:1234/
ProxyPassReverse / https://localhost:1234/
ProxyPassMatch ^/.well-known !
到目前为止一切顺利,这工作正常。但是每次我需要更新我的证书时,我都必须将配置更改为 <Directory> 以便 certbot 可以找到 .well-know 目录。这不是问题,但这次失误的网站处于离线状态,我无法自动化该过程。
所以我研究了Server Fault 和Stack Overflow 几种解决方案,没有任何效果。更接近的解决方案是:Exclude an alias from virtualhost proxypass
但我无法让它工作。使用此配置的最后一次尝试:
ProxyPreserveHost On
ProxyPass / https://localhost:1234/
ProxyPassReverse / https://localhost:1234/
ProxyPassMatch ^/.well-known !
Alias /.well-known "/www/example.com/public_html/.well-known"
<Directory "/www/example.com/public_html/.well-known" >
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
网址example.com/.well-known/acme-challenge/file 被MVC Routing. 捕获
我还创建了一个 index.html 文件来检查 URL example.com/.well-known/acme-challenge/index.html,但发生的情况相同。
我该如何配置?
我正在测试 RegEx,同时我们正在讨论,但是 IDK 从哪里开始解决这个问题。
是的,我每次进行更改时都会重新启动并重新加载服务器。
如果您需要我的 conf 文件中的更多信息或设置,请在配置中向我索取。提前感谢您的提示和帮助!
【问题讨论】:
标签: asp.net regex apache apache2 reverse-proxy