linux - 将 Apache Server 文档根目录重定向到 SpringBoot 应用程序

标签 linux spring-boot apache ubuntu webserver

我修改了文件:
/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 应用程序,但是当我访问该站点时,这就是我所看到的:
enter image description here
当我启动 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”来做到这一点

关于linux - 将 Apache Server 文档根目录重定向到 SpringBoot 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65088739/

相关文章:

java - Spring Boot 导入的目的,然后排除模式?

java - Springboot : Localhost:8080 results in Whitepage-Error instead of showing content

java - Web.xml 文件无法正常工作

apache - 多个 RewriteRule 到一个 RewriteCond

Linux "Perf"工具无法在 docker 镜像中运行?

监视文件夹内文件更改的 linux 脚本(就像 autospec 一样!)

spring-boot - Spring Boot 2.0.0.M4和Hibernate 5.2.11.Final找不到EntityManagerFactoryBuilder类型的bean

java - 如何在tomcat中获取webapp的工作目录?

Linux 删除超过 1 年的文件夹和超过 3 个文件

mysql - 附加文件会导致碎片吗?