Domain name, Tomcat, Postfix, SVN

Hello,

Joined Linode community a week ago! My initial idea was to host a tomcat website. The more that I read the more I am getting interested in setting up a mail server on the same machine and maybe even SVN. I am confused on what to point my domain name. I registered for a domain name via registrar. My initial thinking was that I would just point the domain name to myipaddress:8080/MySite since you need a context root on tomcat. From what I am reading about PostFix and I think which is the correct way is to point the domain name to the ipadddress rather than ipaddress, port and site name. I can change the port of tomcat to point to 80, but if I point the site to the ipaddress only then I would still need to go to ipaddress/MySite in order access my site. I know I can put in a redirect on the ipaddress to point to ipaddress/MySite on port 80, but I do not want the MySite part to be visible.

Would anyone know what a plausible solution would be to this issue? Or can someone help me and point me to the right direction in what I am trying to do?

Any help will be greatly appreciated.

7 Replies

You pretty much have it right, but there are a few other things you can do.

The DNS can only point at a hostname/IP address, the port and path are separate.

You 'can' run tomcat on port 80, but when I was looking to do this earlier this week, I found out that there is a permission problem because tomcat runs as an unprivileged user and can't run on ports below 1024 without a modification. You can either do the modification, or use something to redirect the port: You could use an apache proxy, or an iptables port redirection as you mentioned. You can probably also use the apache proxy to avoid having to display the 'MySite' path.

Another thing you can do to avoid the need for 'MySite' is to configure tomcat to host the site in the web root. I think the correct way to do this is to create a file in the webapps directory called 'ROOT.xml' - this should be a copy of the file that is used to deploy your application, I normally symlink them so that they stay synced.

Hope this helps,

Dan

EDIT: Oh, I didn't mention about the mail server - you probably just need to set it up if the domain name is already pointing at the correct place.

The other option you have is to install apache webserver and route http requests from it to your tomcat workers. You may also consider using apache to serve your static media too.

The extra advantage of running apache is that it will make it easy to setup SVN access via a URL too.

Thank you so much for both of your responses. This solution seems like it might solve another issue that I was having. I was thinking of setting up Redmine and SVN also. Does this mean that I can run SVN and Redmine on apache and my site on tomcat?

I will look for some tutorials on how to accomplish the task. If you know of any please do let me know.

Actually I have one more question. Would using apache as a proxy help me accomplish something like:

www.website.com -> Goes to localhost:8080/MySite

admin.website.com -> Goes to localhost:8080/AdminSite

redmine.website.com -> Goes to site hosted on apache

for admin.website.com or redmine.website.com do I need to purchase anything special? I am actually fine with www.website.com/admin or www.website.com/redmine also but not sure if that is possible in the proxy way.

Hi,

You can definitely do subdomains using apache: you need to add domain entries in DNS and use VirtualHosts in apache.

Dan

@sunnyjassal:

Actually I have one more question. Would using apache as a proxy help me accomplish something like:

http://www.website.com -> Goes to localhost:8080/MySite

admin.website.com -> Goes to localhost:8080/AdminSite

redmine.website.com -> Goes to site hosted on apache

for admin.website.com or redmine.website.com do I need to purchase anything special? I am actually fine with http://www.website.com/admin or http://www.website.com/redmine also but not sure if that is possible in the proxy way.

I use proxying, Apache for static content and certificates, run Tomcat on localhost:8080. This lets me run other servers if I wish on localhost on different ports all front-ended with Apache, certificates in just one place, Apache. I use ProxyPass and ProxyPassReverse. If I operated a high bandwidth site or sites I might change the configuration though so YMMV.

@sunnyjassal:

I was thinking of setting up Redmine and SVN also. Does this mean that I can run SVN and Redmine on apache and my site on tomcat?

Yes definitely. Apache will serve your "normal" websites like Redmine or SVN-via-HTTP and it will then proxy requests for your application through to your tomcat app and the process will be transparent to your end-users, they'll not notice the difference.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct