【发布时间】:2020-12-28 17:59:02
【问题描述】:
我是 .Net Core 和 Linux 的新手,但我正在尝试将我的 MVC 应用程序(在 Windows 上运行良好)部署到使用 Apache 作为反向代理的 Centos。
现在我的应用程序正在运行(作为 Kestrel 服务),这里是 Apache 虚拟主机配置:
<VirtualHost *:*>
RequestHeader set "X-Forwarded-Proto" expr=$scheme
</VirtualHost>
<VirtualHost *:80>
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:5000/
ProxyPassReverse / http://127.0.0.1:5000/
ServerName www.my-domain.com
ServerAlias *.my-domain.com
ErrorLog ${APACHE_LOG_DIR}creditselection-error.log
CustomLog ${APACHE_LOG_DIR}creaditselection-access.log common
</VirtualHost>
但是当我尝试从浏览器访问www.my-domain.com 时,我得到了带有 403 禁止状态的默认 Centos 页面。
另外,如果我在服务器上运行 curl 命令 curl --dump-header - http://localhost:5000,我会得到这个:
HTTP/1.1 307 Temporary Redirect
Date: Mon, 28 Dec 2020 17:53:36 GMT
Server: Kestrel
Content-Length: 0
Location: https://localhost:5001/
然后curl --dump-header - https://localhost:5001 返回:
curl: (60) Issuer certificate is invalid.
More details here: http://curl.haxx.se/docs/sslcerts.html
curl performs SSL certificate verification by default, using a "bundle"
of Certificate Authority (CA) public keys (CA certs). If the default
bundle file isn't adequate, you can specify an alternate file
using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
the bundle, the certificate verification probably failed due to a
problem with the certificate (it might be expired, or the name might
not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
the -k (or --insecure) option.
是否有可能因为我尚未配置 SSL 而在浏览器中收到 403?
我应该如何配置我的应用以使其正常运行?
【问题讨论】:
标签: apache asp.net-core centos7 asp.net-core-3.1 kestrel-http-server