Linux - Server This forum is for the discussion of Linux Software used in a server related context. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
06-04-2011, 06:49 PM
|
#1
|
LQ Newbie
Registered: Jun 2011
Posts: 11
Rep:
|
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!
|
|
|
06-05-2011, 09:25 AM
|
#2
|
Senior Member
Registered: Sep 2010
Distribution: Debian
Posts: 1,632
|
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,
|
|
|
06-05-2011, 10:09 AM
|
#3
|
LQ Newbie
Registered: Jun 2011
Posts: 11
Original Poster
Rep:
|
OOps, forgot the mention, without web server.
It takes too much RAM to run a web server for just redirecting users to other sites.
|
|
|
06-06-2011, 07:27 AM
|
#4
|
Senior Member
Registered: Jan 2004
Location: Montpellier (France)
Distribution: Gentoo
Posts: 1,014
Rep:
|
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'
|
|
|
06-06-2011, 02:33 PM
|
#5
|
LQ Newbie
Registered: Jun 2011
Posts: 11
Original Poster
Rep:
|
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.
|
|
|
06-07-2011, 12:18 PM
|
#6
|
Senior Member
Registered: Jan 2004
Location: Montpellier (France)
Distribution: Gentoo
Posts: 1,014
Rep:
|
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'
|
|
|
06-07-2011, 01:31 PM
|
#7
|
LQ Newbie
Registered: Jun 2011
Posts: 11
Original Poster
Rep:
|
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.
|
|
|
All times are GMT -5. The time now is 09:40 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|