Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to split port 80, 8080 requests?

Status
Not open for further replies.

Newposter

Technical User
May 9, 2002
735
US
For reasons I won't go into, I'm migrating some domains from Windows to linux, and want to be able to have both servers active for a time while I transfer and test the sites. My router currently handles port 80 requests and forwards them to the Windows server. I want to move one domain at a time to the linux box, and understand that I need to use another port for those requests.

My question is, how do I redirect requests for the linux domains in from the router to the linux box? My domain registry won't let me alias domain.com to domain.com:8080, so I guess the request hits the router as port 80. If I forward 80 to 8080 on the linux box, then won't requests for the Windows sites crap out? There must be a way to do this with the existing hardware setup. Newposter
"Good judgment comes from experience. Experience comes from bad judgment."
 
This is going to be quite difficult (if not impossible) with your current setup. I recommend setting up everything like normal on the linux box. Do whatever testing you can locally, then just change your router forwarding to the linux box and complete testing. If something goes wrong, you can immediately change your router forwarding back the windows box to minimize downtime while you work on what went wrong.
 
Thanks, this was just suggested to me by a colleague.

The other way he suggested was to set up an error page on the Windows box to redirect to port 81 of the linux box, and have the router forward 81 to 81. This would be a way of keeping the Windows box up as a server for whoever wants their site on that instead of a better system. Newposter
"Good judgment comes from experience. Experience comes from bad judgment."
 
That might work, but it might take some thought because I'm not sure what would happen for this scenario:

on the windows computer redirects to Now your router sends this request to the linux box and displays some index.htm. What happens when there's a link on that page that points to some file named page2? Does it point to or does it drop the port - which would send it back to the windows box. I think that if the link is local (doesn't include the full domain) it would work, but I haven't tried it to be sure and even if it worked you really would have to check every link and path to make sure the domain wasn't included.
 
One thing I found out is that IIS doesn't comply with RFC2616. Redirects give errors in IIS even though they seem to work.

 
I would never use IIS - security holes.

I set my router to forward port 81 to 81 of the linux box; configured the root directory of the linux Apache to the domain I moved to the linux box and to listen to the internal IP at port 81; set the linux firewall to allow http requests; set file permissions to 775; commented out the domain that was on the Windows box and restarted the Windows Apache; restarted the linux Apache; and tried to browse on the linux box to and results were:

popup box saying: The connection was refused when attempting to contact internalIP.

tried to browse on the linux box to and results were:

Forbidden

You don't have permission to access / on this server.

Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.

I shut down Apache on Windows and repeated the linux test with the same results.

SoO what did I overlook? Newposter
"Good judgment comes from experience. Experience comes from bad judgment."
 
Thu Feb 13 19:56:20 2003] [error] [client 192.168.1.xxx] (13)Permission denied: access to / denied
[Thu Feb 13 19:56:31 2003] [error] [client 192.168.1.xxx] (13)Permission denied: access to / denied
[Thu Feb 13 20:04:22 2003] [error] [client 192.168.1.xxx] (13)Permission denied: access to / denied
[Thu Feb 13 20:07:25 2003] [error] [client 192.168.1.xxx] (13)Permission denied: access to / denied
[Thu Feb 13 20:07:27 2003] [error] [client 192.168.1.xxx] (13)Permission denied: access to / denied Newposter
"Good judgment comes from experience. Experience comes from bad judgment."
 
If you execute [tt]ls -la /[/tt] on the Linux box, what does it show for the . (dot) directory? I'm not sure if it means / or the document root with the / in that error message... //Daniel
 
drwxr-xr-x for what I set as the server root.

-rwxr-xr-x for the index.htm in the directory.

-rwxr-xr-x for other files in the directory, including graphics files.

In the httpd.conf, directory options were:
Options Indexes Includes FollowSymLinks

There are typos in the httpd.conf as loaded, they had:
Allow from from all

for permissions.

I set Options to include Multiviews and fixed the typos, restarted Apache. Same results. Newposter
"Good judgment comes from experience. Experience comes from bad judgment."
 
Still, what does it show for the / (root) directory on the Linux box? //Daniel
 
ls -la for the root directory is:

drwxr-xr-x for usr, home, var, bin, boot, dev, lib, etc directories, with root as owner of all. Newposter
"Good judgment comes from experience. Experience comes from bad judgment."
 
Looking again at the httpd.conf, the Server Root is /etc/httpd but I set my Directory under a subdirectory in /home. That's where I prefer my domain roots to be. Is this my problem, though? Should I set the Server Root to the same directory as designated for the domain in /home? Newposter
"Good judgment comes from experience. Experience comes from bad judgment."
 
ServerRoot is where the configuration files, binaries, modules etc. are located.
I had a similar problem a few days ago when I reset all the permissions in the /home directory to 0700. I then remembered that Apache changes directory all the way through the directory tree, so if your DocumentRoot is /home/domain.com/html, Apache first goes to /, looks for .htaccess, then goes to /home, looks for .htaccess, then goes to /home/domain.com... and so on until it gets to whereever it's headed. I'd recommend checking the permissions on all directories all the way from the root. //Daniel
 
I noticed that my firewall settings are set to High, and when I set them to Custom and allow http, then save, the window in the GUI closes. *EVERYTIME* I open the security GUI again, it's set back to High. So I think I have a problem with not being able to set and save firewall settings on the linux box. Newposter
"Good judgment comes from experience. Experience comes from bad judgment."
 
No, that's just the way the program was made... Since you see the forbidden error, that means that the HTTP traffic is coming through. //Daniel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top