Apache如何将代理反向到ASPnet核心API和Anular 6应用程序



我有一个aspnet core apilocalhost:8080上运行(红隼(。一切都在localhost:80(apache反向代理(上完美运行,可以从互联网上访问www.example.com

我想在这个端口locahost:80(www.example.com(上部署角度客户端,并且仍然能够访问www.api.example.comwww.example.com/api上的api。如何在.conf文件中修改虚拟主机?

<VirtualHost *:*>
RequestHeader set "X-Forwarded-Proto" http
RequestHeader set "X-Forwarded-Proto" https
</VirtualHost>
<VirtualHost *:80>
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:8080/
ProxyPassReverse / http://127.0.0.1:8080/
ServerName www.example.com
ServerAlias *.example.com
ErrorLog /var/log/httpd/core_log
CustomLog /var/log/httpd/core_access_log common
</VirtualHost>

尝试:

ProxyPass /api/ http://127.0.0.1:8080/api/
ProxyPassReverse /api/ http://127.0.0.1:8080/api/

最新更新