linux - 将 Apache Server 文档根目录重定向到 SpringBoot 应用程序
问题描述
我修改了文件:
/etc/apache2/sites-available/elcor.com.conf
添加:
<VirtualHost *:80>
# Admin email, Server Name (domain name), and any aliases
ServerAdmin webmaster@elcor.com
ServerName elcor.com
ServerAlias www.elcor.com
ProxyPass / http://localhost:8080/home.html
ProxyPassReverse / http://localhost:8080/html
# Index file and Document Root (where the public files are located)
DirectoryIndex index.html index.php
DocumentRoot /var/www/html/elcor.com/public_html
# Log file locations
LogLevel warn
ErrorLog /var/www/html/elcor.com/log/error.log
CustomLog /var/www/html/elcor.com/log/access.log combined
</VirtualHost>
为了访问我在同一服务器中的 SpringBoot 应用程序,但是当我访问该站点时,这就是我所看到的:
当我启动 Apache 我有这个错误:
-- The job identifier is 483.
Dec 01 14:16:08 localhost apachectl[1099]: AH00526: Syntax error on line 9 of /etc/apache2/sites-enabled/elcor.com.conf:
Dec 01 14:16:08 localhost apachectl[1099]: Invalid command 'ProxyPass', perhaps misspelled or defined by a module not included in the server configuration
Dec 01 14:16:08 localhost apachectl[1086]: Action 'start' failed.
Dec 01 14:16:08 localhost apachectl[1086]: The Apache error log may have more information.
Dec 01 14:16:08 localhost systemd[1]: apache2.service: Control process exited, code=exited, status=1/FAILURE
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
解决方案
可能是您没有在系统上启用 mod_proxy 的情况吗?
你可以通过 ubuntu 系统上的“a2enmod proxy_http”来做到这一点
推荐阅读
- javascript - Angular 等到订阅完成并为其他函数赋值
- ios - 从 Firebase 中检索没有重复的数据
- java - 点击通知后实现intent方法(NotificationCompat.Builder)
- javascript - 为什么我不能在反应中从 json 读取对象?
- c++ - 在新线程中调用成员函数
- android - 如何在 MediaStyle 通知中显示 MediaPlayer 位置 - Android
- c# - 如何链接图像源 =“?” 使用 DataTable 中的值(路径图像)?wpf
- google-apps-script - 在 Google 表格中,如何编写脚本将绘图移动到工作表上的特定位置?
- javascript - 有没有办法检测文本区域内的编程代码?
- c - 替换文本文件中的单词的功能未按预期工作