[英]Apache reverse proxy subdomain to port
我正在尝试设置一个 apache 反向代理来实现以下结果。
预期成绩
当访问https://service.example.com
,apache 将提供来自http://localhost:8080
,这是在本地主机上运行的另一个服务/网络服务器。
实际结果
访问https://service.example.com
apache 会返回来自https://example.com
内容(并提供一些证书问题)。
当前配置
有一个 SSL apache 服务器正在https://example.com
上运行,并带有一个 let encrypt 通配符证书。
应该启用反向代理的虚拟主机文件如下所示
<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>
该文件已使用 a2ensite service.conf 激活并具有指向/sites-enabled
符号链接
如何解决这个问题? 感谢所有帮助。
如果问题仍然存在,则域末尾缺少斜杠:
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
另外,不要忘记启用代理模块:a2enmod proxy_http
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.