Question

What is the basic things to be follow for mapping a tomcat web application to domain?

Hi,

I have a domain from godaddy with running tomcat7 application and that was configured in apache using proxy. Now i would like to move entire thing to tomcat only. I don’t need apache now. How should i create a host in tomcat? Where and where i need to update the newly added domain code in tomcat7?

Can anyone suggest me?

Thanks in advance.

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

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

Sign In or Sign Up to Answer

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.

Your apache proxy settings looks a bit off. Save a copy of your existing apache configuration somewhere else (like your home directory), and try modifying your current apache configuration entries to something like this

<VirtualHost *:80>
 ServerName www.domain.com
 ProxyPreserveHost       On
 ProxyRequests   Off
 ProxyPass / http://localhost:8080/domain/
 ProxyPassReverse / http://localhost:8080/domain/
 RewriteEngine on
 RewriteCond %{SERVER_NAME} =www.domain.com
 RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]
</VirtualHost>

<VirtualHost *:443>
 ProxyPreserveHost On
 ProxyRequests Off
 ProxyPass / http://localhost:8080/domain/
 ProxyPassReverse / http://localhost:8080/domain/
 ServerName www.domain.com
 SSLEngine on
 SSLCertificateFile /home/developer/domain.crt
 SSLCertificateKeyFile /home/developer/domain.key
 SSLCertificateChainFile /home/developer/intermediate.crt
 SSLCACertificateFile /home/developer/ca-bundle.crt
 </VirtualHost>

A few more non-critical notes: the standard location for your SSL certificates should reside on a secure location, like somewhere in /etc. Also, you may want to explicitly add the error and access logging locations in the section shown above.

Hope that works for you.

Tomcat as your primary web server is not recommended since you’ll have a difficult time setting up security arrangements, like setting security certificates for https. Having said that, the quickest way is to disable or remove apache/nginx from listening to port 80, and then configure Tomcat to take over that port.