Serve java application on port 8080 as default and blog.mydomain on port 80

April 16, 2014 2.8k views
Hi. My full application is a mix of a Wordpress blog and a Java application. I'm running Apache and Apache Tomcat on the same droplet. In this way, if I try it runs my Wordpress blog, and if I try it runs my Java application. Both applications are running fine. But what I need is: - runs the Java application; - runs the Wordpress blog; Is there anyway to do that with DNS or a virtual server? I'm very confused of how do I configure my Apache server to do that. Thanks a lot.
6 Answers
You can't setup apache and tomcat both on port 80

But you can setup both domain on apache with proxying localhost:8080

The following command should be enough to to enable mod_proxy (ubuntu)
sudo a2enmod proxy

Then change your site config file to something like this:

Listen 80


ProxyRequests Off

Order Deny,Allow
Allow from all

ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/'s configs ...

You have to install & enable mod_proxy
Listen 80
< VirtualHost *:80>

ProxyRequests Off

< Proxy *>
Order Deny,Allow
Allow from all
< /Proxy>

ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
< /Virtualhost>

Those < > tag just got eaten ...
Thanks a lot! I'm almost there!

The is working fine!! So, it's 50% success!

But the is returning this:


Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, [no address given] and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Apache/2.2.22 (Ubuntu) Server at Port 80


Is there anything missing?
Is there any output in /var/log/apache2/error.log
No, but I made it.

For some reason I had to execute this:

a2enmod proxy_http

Now it's working.

Thanks to you all.


in which file you add the configurations?


Have another answer? Share your knowledge.