A lot of the time when I am deploying applications on Railo, you get the installer, and install a version of tomcat (for example) and then setup Railo and then finally install Apache or NGinx.
This has been working well for a while but what if you dont want that extra webserver layer? There are times where I don't see the point of setting up Apache since all it will be doing (in my case) is proxying from port 80 to port 8080.
There are a couple of things you can do:
- Try and change the port in tomcat by editing server.xml
- Use iptables to redirect the port without having to install anything else!
Recently I got into a Yak Shaving situation where having changed the port of Tomcat to port 80, meant that I need to change the user that Tomcat was going under (and I didn't want to do that!) so meant I had to do a bunch of other stuff and essentially meant that the only way out would be to install a web server. Which seemed overkill for the app (well, service) I wanted to deploy.
IPTABLES to the rescue!
After a quick trawl around the internet I found the solution, which was just to put some redirects in iptables.
sudo iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8080
sudo iptables -t nat -I OUTPUT -p tcp --dport 80 -j REDIRECT --to-ports 8080
This achieves the goal I was looking for without the need to configure yet another service (that will need restarting when we do other changes etc)
What do you think? Useful?
comments powered by Disqus