apache - Apache:同一服务器上的两个域具有不同的端口
问题描述
我是这个东西的新手,所以如果我在做一个愚蠢的问题,请原谅我。我有一个运行在端口 80 上的 vue 应用程序在 SSL 上运行良好(比如www.domain.com和 domain.com)。
现在我需要我的 springboot 应用程序,它运行在端口 8443 上,也可以通过安全连接访问(比如在 api.domain.com 上),但我不太清楚我做错了什么......我可以访问api 如果我不包括第二个虚拟主机,而只使用 http... 另外,当我输入 api.domain.com 时,它也会转到 domain.com 起始页。当我包含第二个虚拟主机时,我什至无法访问 domain.com。
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ServerName www.domain.com
Include /etc/letsencrypt/options-ssl-apache.conf
ServerAlias domain.com
ProxyPreserveHost On
SSLCertificateFile /etc/letsencrypt/live/domain.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/domain.com/privkey.pem
</VirtualHost>
<VirtualHost *:443>
ServerAdmin webmaster@localhost
ServerName api.domain.com
Include /etc/letsencrypt/options-ssl-apache.conf
ServerAlias api.domain.com
SSLCertificateFile /etc/letsencrypt/live/domain.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/domain.com/privkey.pem
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:8443/
ProxyPassReverse / http://127.0.0.1:8443/
</VirtualHost>
</IfModule>
解决方案
发现它:有一些 apache 模块需要激活。刚做了
sudo a2enmod proxy
sudo a2enmod proxy_http
一切都像魅力一样。
推荐阅读
- php - 如何修复错误:在以下情况下,magento2 导入中已存在 URL KEY
- android - 获取数据后重构我自己的 JsonArray
- java - 如何从字符串的上下文创建 java 类文件
- laravel - 如何将 onDelete('RESTRICT') 更改为 CASCADE
- javascript - 如何重定向到闪亮的动态URL?
- python - 如何阅读某些pdf文件中的所有内容,除了其中的表格?
- java - 为 SendGrid 创建 JUnit 测试
- css - 向左展开openlayer ScaleLine
- docker - 启动 Hyperledger 网络的问题
- c# - 如何在 Google Assistant 中显示来自 Dialogflow Webhook 的表格卡片