Virtual Server on Apache to listen on an alternate port



In the last few days, I had to set up something a bit unusual with apache. Basically the goal was to have apache listen for connections on two different ports (the standard port 80 and an alternate port 85). The problem was that I wanted different content at each port. Port 85 was to be an .htaccess redirect for another domain (with some port forwarding magic at the firewall.) Port 80 was to remain an internal intranet page. So…. this was all done with vhosts (virtual hosts.)


The previous setup had been apache for port 80 and thttpd for port 85, but there were disadvantages with that setup (thttpd didn’t support .htaccess redirects that I could see and that solution had to resort to a redirect in an html page which wasn’t as clean a redirect.) On the Mandrake based server it was fairly simple…. in /etc/httpd/2.0/conf/vhosts/Vhosts.conf I had to setup the virtual host settings (default directory/address/port to bind…)

NameVirtualhost 192.168.5.20:85
<VirtualHost 192.168.5.20:85>
Servername myserver2.lan.net
DocumentRoot /var/www/html/redirect
</VirtualHost>

And in /etc/httpd/2.0/conf/httpd2.conf, I had to add port 85 to be listened to (and uncomment the include of the Vhost file…)

Include conf/vhosts/Vhosts.conf

<IfDefine !APACHEPROXIED>
#Removed by Apache 2.0 — Port 80
Listen 80
Listen 85
</IfDefine>

There’s a good writeup at apacheweek on virtual hosts and configuring them based on ip address and port.

Related Posts

Blog Traffic Exchange Related Posts
  • Qemu 0.8.1 speed improvement with -kernel-kqemu and kqemu 1.3.0pre7 I mentioned the other day revisiting the qemu site to discover new versions of both qemu and the non-redistributable kernel module kqemu (qemu is now at version 0.8.1 and kqemu is at 1.3.0pre7). There's also a new startup switch -kernel-kqemu which enables FULL virtualization of both kernel and user code.......
  • Evolution email error MAIL FROM command failed: Unknown Some time back, I was teetering on the brink.... I've used Evolution as my linux mail client for ages (since I switched), because it had the calender integrated etc... However, Kontact has REALLY looked nice for some time, but I didn't have time to mess with changing. Then one day,......
  • chkconfig for ubuntu or other debian based linux systems As I've mentioned I've got an ubuntu based test system. Most of my linux experience has been from a red-hat derivitive-based background and for that, at the command line, you have chkconfig which is a good tool for checking the configuration of services to run at startup. It is a......
Blog Traffic Exchange Related Websites
  • Gold Tops Last Year's High I've been spending the past few days writing and re-writing B-school essays for the Jan 3rd deadline. Wasn't going to post until the 4th, but with gold breaking previous records, I just had too! Gold is currently trading for $857/oz, beating the previous high of $850/Oz that was set 28......
  • Don't Spend Money to Make Money. Earn $125 in 24 hrs. Guaranteed. Free. Interesting Information to Keep in Mind Great way to make money without having money! Have you been searching tirelessly for a way to generate income online without having to pay a fee to get started?So have I.Luckily for us, I found it. Its called acme people search.com and it is designed to set you up with......
  • P.E.P for Week of April 12-16, 2010 Introducing the new Prairie Eco-Thrifter Picks! Every Friday, I will be posting links to the best blog posts of the week from various frugal livers like us. Please feel free to check them out and see if there are any tips you can use. If you find any other articles......
www.pdf24.org    Send article as PDF   

Similar Posts


See what happened this day in history from either BBC Wikipedia
Search:
Keywords:
Amazon Logo

Comments are closed.


Switch to our mobile site