LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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 12-18-2011, 08:06 AM   #1
ScorchPipe
Member
 
Registered: Sep 2010
Posts: 38

Rep: Reputation: 0
Apache - redirect to internal server


Hi

I have a web server running Apache. Here I have a website with some personal, useful stuff like ruTorrent, system information, webmin, Motion etc

Some time ago I installed Op5 on a different machine. Op5 has it's own web interface and database.

I want to be able to access this web interface through a <a href> link on my usual website. Maybe like a location in httpd.conf where mywebsite.com/op5 will put me through to the Op5 machine.

Both servers are behind a router and I still want to use standard ports.

Is there a way to solve this?

CentOS is running on both machines btw

edit:
Ofc, the best would be if it still looks like the user is on mywebsite.com/op5 in the adress field

Last edited by ScorchPipe; 12-18-2011 at 08:09 AM.
 
Old 12-18-2011, 09:29 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi,

You can use apache as a reverse proxy:
Code:
ProxyRequests Off
ProxyPass /op5 http://x.x.x.x
ProxyPassReverse /op5 http://x.x.x.x
where x.x.x.x is the internal IP of your box running that Op5

Regards
 
Old 12-18-2011, 11:23 AM   #3
ScorchPipe
Member
 
Registered: Sep 2010
Posts: 38

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by bathory View Post
Hi,

You can use apache as a reverse proxy:
Code:
ProxyRequests Off
ProxyPass /op5 http://x.x.x.x
ProxyPassReverse /op5 http://x.x.x.x
where x.x.x.x is the internal IP of your box running that Op5

Regards
Hi and thanks for your response.

I added this to httpd.conf and restarted httpd. Now it works when I'm on my LAN, but not from the outside.
Gets "connection has timed out" because it's trying to contact my internal IP
 
Old 12-18-2011, 11:41 AM   #4
bmarx
Member
 
Registered: Dec 2004
Distribution: Slackware, Arch, FreeBSD
Posts: 202

Rep: Reputation: 34
What does the link inside <A HREF=""> look like? It should be referencing the public server, not the internal host behind the proxy.
 
Old 12-18-2011, 12:59 PM   #5
ScorchPipe
Member
 
Registered: Sep 2010
Posts: 38

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by bmarx View Post
What does the link inside <A HREF=""> look like? It should be referencing the public server, not the internal host behind the proxy.
It doesn't exists yet. I just went to mywebsite.com/op5 to test bathory's method
 
Old 12-18-2011, 03:23 PM   #6
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
Now it works when I'm on my LAN, but not from the outside.
Gets "connection has timed out" because it's trying to contact my internal IP
Doesn't make sense. If the frontend apache can connect to the backend webserver with its internal IP, it should work the same either from LAN and from the internet.
 
Old 12-18-2011, 03:36 PM   #7
ScorchPipe
Member
 
Registered: Sep 2010
Posts: 38

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by bathory View Post
Doesn't make sense. If the frontend apache can connect to the backend webserver with its internal IP, it should work the same either from LAN and from the internet.
The connection between them is just fine. Also tried without any firewalls running.

Same problem:
"The connection has timed out
The server at 192.168.0.198 is taking too long to respond."
 
Old 12-18-2011, 04:23 PM   #8
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
"The connection has timed out
The server at 192.168.0.198 is taking too long to respond."
I don't know what to tell
If the frontend can connect to the backend (I guess it's 192.168.0.198), then there should be no problem. Maybe your router is doing something nasty.
Anyway you can add the following before the other proxy directives, to see if they help
Code:
<Proxy *>
    Order deny,allow
    Allow from all
</Proxy>
ProxyPreserveHost On
ProxyTimeout 300
...
 
Old 12-18-2011, 04:57 PM   #9
ScorchPipe
Member
 
Registered: Sep 2010
Posts: 38

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by bathory View Post
I don't know what to tell
If the frontend can connect to the backend (I guess it's 192.168.0.198), then there should be no problem. Maybe your router is doing something nasty.
Anyway you can add the following before the other proxy directives, to see if they help
Code:
<Proxy *>
    Order deny,allow
    Allow from all
</Proxy>
ProxyPreserveHost On
ProxyTimeout 300
...

Tried it. Now it says
"The server at mywebsite.com is taking too long to respond"
from both inside and outside.

I will look into the router, but I don't think I will find anything there

Thanks for your help anyway
 
Old 12-19-2011, 02:08 AM   #10
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
Tried it. Now it says
"The server at mywebsite.com is taking too long to respond"
from both inside and outside.
I guess it's the timeout that is too big and your browser times out first.
I can't think of anything else about the initial problem. If the reverse proxy works through your LAN, it should work from the outside too.
It's maybe your router, or the backend application (op5) needs some special settings to work behind a reverse proxy
 
  


Reply

Tags
apache, centos, web



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
[SOLVED] Apache: IP- and port-based virtual server with Redirect catkin Linux - Server 2 04-11-2011 11:42 PM
Apache: redirect different domains to different internal servers eco Linux - Server 2 04-23-2010 03:03 PM
Apache - redirect sub-directories to different server? sencha Linux - Server 2 09-30-2009 09:53 AM
redirect from webserver to internal server in lan in rhel4.0 msb_suresh80 Linux - Newbie 1 10-10-2008 11:31 AM

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

All times are GMT -5. The time now is 07:17 PM.

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