apache - Apache reverse proxy subdomain to port
问题描述
I'm trying to setup an apache reverse-proxy to achive following results.
Expected Results
When visiting https://service.example.com
, apache will serve content from http://localhost:8080
, which is another service/webserver being run on the localhost.
Actual Results
When visiting https://service.example.com
apache gives back content from https://example.com
(and gives some certificate issues).
Current configuartion
There is an SSL apache server being run at https://example.com
with a lets encrypt wildcard certificate.
The virtual-host file that is supposed to enable the reverse-proxy looks the following
<VirtualHost *:80>
ServerName service.example.com
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://localhost:8080
ProxyPassReverse / http://localhost:8080
<Location />
Order allow,deny
Allow from all
</Location>
</VirtualHost>
The file has been activated with a2ensite service.conf and has symbolic link to /sites-enabled
How does one resolve this problem? All help is appreciated.
解决方案
如果问题仍然相关,则您在域末尾缺少斜杠:
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
另外,不要忘记启用代理模块:a2enmod proxy_http
推荐阅读
- flutter - 重新加载颜色容器以清除 Flutter 中的 TextField
- hyperledger-fabric - 如何从 docker 容器上运行的客户端应用程序连接到 Fabric 网络
- sql - 仅检索每个学生的第一行
- ansible - Ansible:在另一个循环中引用的循环变量
- javascript - 箭头函数未定义
- java - 如何忽略 Xpath 中的特定字符?
- angular - Angular Overlay 将不存在的 dom 元素称为覆盖容器
- javascript - Chainlink 外部适配器对 Spotify 进行 API 调用时出现问题
- database - 安装 mongoose 和 Mongodb 时出错
- database - Oracle DB - 连接问题