Skip to content
Advertisement

redirect Apache Server document root to SpringBoot app

I have modified the file:

/etc/apache2/sites-available/elcor.com.conf

adding:

<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>

in order to access a SpringBoot app I have in the same server, but when I acees the site, this is what I see:

enter image description here

When I start Apache I have this error:

-- 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

Advertisement

Answer

could it be the case you did not enable mod_proxy on your system?

you can do that via “a2enmod proxy_http” on your ubuntu system

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement