Question

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

  • Posted April 16, 2014

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 http://mydomain.com it runs my Wordpress blog, and if I try http://mydomain.com:8080 it runs my Java application. Both applications are running fine.

But what I need is:

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.

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

hello!

in which file you add the configurations?

regards

No, but I made it. <br> <br>For some reason I had to execute this: <br> <br>a2enmod proxy_http <br> <br>Now it’s working. <br> <br>Thanks to you all.

Is there any output in /var/log/apache2/error.log

Thanks a lot! I’m almost there! <br> <br>The blog.mydomain.com is working fine!! So, it’s 50% success! <br> <br>But the www.mydomain.com is returning this: <br> <br>– <br> <br>Internal Server Error <br> <br>The server encountered an internal error or misconfiguration and was unable to complete your request. <br> <br>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. <br> <br>More information about this error may be available in the server error log. <br> <br>Apache/2.2.22 (Ubuntu) Server at www.consuporteconsultoria.com.br Port 80 <br> <br>– <br> <br>Is there anything missing?

Listen 80 <br>< VirtualHost *:80> <br>ServerName mydomain.com <br> <br>ProxyRequests Off <br> <br>< Proxy *> <br>Order Deny,Allow <br>Allow from all <br>< /Proxy> <br> <br>ProxyPass / http://localhost:8080/ <br>ProxyPassReverse / http://localhost:8080/ <br>< /Virtualhost> <br> <br>Those < > tag just got eaten …

You can’t setup apache and tomcat both on port 80 <br> <br>But you can setup both domain on apache with <br>mydomain.com proxying localhost:8080 <br> <br>The following command should be enough to to enable mod_proxy (ubuntu) <br>sudo a2enmod proxy <br> <br>Then change your site config file to something like this: <br> <br>Listen 80 <br><VirtualHost *:80> <br>ServerName mydomain.com <br> <br>ProxyRequests Off <br> <br><Proxy *> <br> Order Deny,Allow <br> Allow from all <br></Proxy> <br> <br>ProxyPass / http://localhost:8080/ <br>ProxyPassReverse / http://localhost:8080/ <br></VirtualHost> <br> <br><VirtualHost *:80> <br> blog.mydomain.com’s configs …
<br></VirtualHost> <br> <br>You have to install & enable mod_proxy