我有一个aspnet core api
在localhost:8080
上运行(红隼(。一切都在localhost:80
(apache反向代理(上完美运行,可以从互联网上访问www.example.com
我想在这个端口locahost:80
(www.example.com
(上部署角度客户端,并且仍然能够访问www.api.example.com
和www.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/