我已经使用 Jhipster 生成了我的应用程序。将其配置为使用 Ubuntu 16.x 和 apache 在 amazon ec2 上运行,具有以下配置和 godaddy 记录。当我点击网站 url 时,它会毫无问题地映射和呈现网站。
apache2 配置
<VirtualHost *:80>
ServerName 111.22.33.444
ProxyPreserveHost On
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://111.22.33.444:8080/
ProxyPassReverse / http://111.22.33.444:8080/
</VirtualHost>
嵌套步骤,尝试配置 SSL。我已经从 godaddy 为我的域购买了 SSL,配置它并将 *.crt 文件上传到/etc/apache2/ssl。我很快意识到仅仅通过为端口 443 添加另一个虚拟主机配置是行不通的,因为 JHipster 应用程序在 8080 上运行。我回去查看了 https://www.jhipster.tech/production/并且他们有关于使用使用前端代理的 HTTPS 配置配置 SSL 的说明,这让我迷路了,无法配置 SSL 并在 https 上提供我的域。
不清楚的是,我是否仍可以在 8080 上运行该应用程序并简单地按照使用前端代理配置 HTTPS 下的说明进行操作?首先,我使用以下命令使用“lets encrypt”配置了 apache
sudo certbot --apache -d doamin.com --agree-tos -m info@domain.com --redirect
它说失败了
domain.com 重定向失败
无法为 domain.com 设置增强重定向
没用。
我需要对 Jhipster 应用程序进行哪些更改?它应该在 443 上运行还是继续运行 8080 并更新虚拟主机配置?我应该如何配置虚拟主机?
我在没有说明的情况下到处搜索。非常感谢任何方向。
最佳答案
假设您的应用在 http://127.0.0.1:8080/ 可用,您可以按照以下步骤使用 Certbot 为 HTTPS 成功配置 Apache。
设置服务器:
sudo apt-get update
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt-get install python-certbot-apache apache2
从配置开始:
<VirtualHost *:80>
ServerName example.com
ServerAlias example.com
ProxyPass / http://127.0.0.1:8080/
ProxyPassReverse / http://127.0.0.1:8080/
ProxyPreserveHost On
ProxyRequests Off
</VirtualHost>
启用插件并重启 Apache2,使应用程序可以在上面配置的域中访问:
a2enmod headers proxy proxy_http
service apache2 restart
然后使用 the instructions in the docs 运行 certbot :
sudo certbot --apache -d example.com
之后,您的应用程序将可以在您配置的域中通过 HTTPS 访问。
关于spring-boot - jhipster ssl ubuntu apache2 设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51128096/