LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 06-04-2011, 06:49 PM   #1
JackL92
LQ Newbie
 
Registered: Jun 2011
Posts: 11

Rep: Reputation: Disabled
Question Linux port forward or redirect question.


I have a VPS and a Webserver(different host), both of them are linux.

I would like to redirect port 80 from my VPS to my Webserver, however, I can only use domain to as my webserver address.

For example, if I type my-VPS-IP into IE, my VPS will forward/redirect my IE request to my webserver.

How can I do this and thank you!
 
Old 06-05-2011, 09:25 AM   #2
Snark1994
Senior Member
 
Registered: Sep 2010
Distribution: Debian
Posts: 1,632
Blog Entries: 3

Rep: Reputation: 346Reputation: 346Reputation: 346Reputation: 346
Couldn't you just do this using your .htaccess file?

I think something like:
Code:
RewriteEngine on
RewriteRule ^(.*)$ http://www.webserver.com/$1 [R=301,L]
would work. However, if I've misunderstood what you're asking, do correct me

Hope this helps,
 
Old 06-05-2011, 10:09 AM   #3
JackL92
LQ Newbie
 
Registered: Jun 2011
Posts: 11

Original Poster
Rep: Reputation: Disabled
OOps, forgot the mention, without web server.
It takes too much RAM to run a web server for just redirecting users to other sites.
 
Old 06-06-2011, 07:27 AM   #4
Oliv'
Senior Member
 
Registered: Jan 2004
Location: Montpellier (France)
Distribution: Gentoo
Posts: 1,014

Rep: Reputation: 36
Hello,

I have 2 solutions:
1) use iptables https://adminuser.wordpress.com/2008...sing-iptables/
2) use netcat:
Code:
nc -l -p 80 -c 'nc www.google.com 80'
Be aware that with netcat you will have a quick and dirty solution. Moreover, you will have to respawn the command after each connection to port 80.
So if you want a clean solution: choose iptables one.

Kind regards,

Oliv'
 
Old 06-06-2011, 02:33 PM   #5
JackL92
LQ Newbie
 
Registered: Jun 2011
Posts: 11

Original Poster
Rep: Reputation: Disabled
Hmm, the iptables one is the best, however, it cannot redirect to domain.
There are may traffic I cannot stay infront of my computer for the second solution respawn the command after each connection to port 80.

I guess this is almost to impossible to redirct with domain.
 
Old 06-07-2011, 12:18 PM   #6
Oliv'
Senior Member
 
Registered: Jan 2004
Location: Montpellier (France)
Distribution: Gentoo
Posts: 1,014

Rep: Reputation: 36
Why can't you redirect by IP but just by domain ? You do not have a static IP ? or you are in complex architecture where one domain may refer to multiple IP ?
Anyway about your problem, I think that with a good script based on netcat approach, it is do-able.

Best regards,

Oliv'
 
Old 06-07-2011, 01:31 PM   #7
JackL92
LQ Newbie
 
Registered: Jun 2011
Posts: 11

Original Poster
Rep: Reputation: Disabled
cuz my web server have multi-domain host on it. the server can only get you to the right place with domain.
I guess ill install apache(httpd) instead, hopefully it wont take too much RAM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Squid question about port redirect ge2000 Linux - Networking 13 11-19-2009 10:15 AM
Redirect port from Linux to WinXP raqib Linux - General 11 03-10-2008 04:26 AM
iptables forward/redirect: the easy way? efm Linux - Networking 2 01-29-2008 08:59 PM
ssh port forward/tunnel question djwhitey Linux - Networking 4 04-06-2006 05:05 PM
iptables forward port question lnx8 Linux - Security 3 05-06-2004 10:35 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 09:40 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration