Domain name, Tomcat, Postfix, SVN
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
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 extra advantage of running apache is that it will make it easy to setup SVN access via a URL too.
I will look for some tutorials on how to accomplish the task. If you know of any please do let me know.
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
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/MySiteadmin.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 orhttp://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.