|
|
Can I run two Apache servers off one IP?
|
|
|
|
Addicted to MacNN
Join Date: Jan 2000
Location: Stoneham, MA, USA
Status:
Offline
|
|
I don't mean virtual hosts either, I already run 4 web sites off one Server that way, and it works awesome. What I wanna do is break one of those sites off so it is its own machine. But I still need my Server to somehow forward requests for it to the other web server, which is going to have an internal IP address only. I know I could set up a tiny page on my main server that would forward to another port, which I could map to my other server, but I'd like to have a way to seemlessly connect it, so this domain would truley be hosted off the other server. Possible?
|
|
|
|
|
|
|
|
|
Mac Elite
Join Date: Apr 2001
Location: Minneapolis, MN
Status:
Offline
|
|
|
|
|
|
|
|
|
|
|
Addicted to MacNN
Join Date: Jan 2000
Location: Stoneham, MA, USA
Status:
Offline
|
|
|
|
|
|
|
|
|
|
|
Professional Poster
Join Date: Nov 2000
Location: Tasmania, Australia
Status:
Offline
|
|
|
|
|
|
|
|
|
|
|
Addicted to MacNN
Join Date: Jan 2000
Location: Stoneham, MA, USA
Status:
Offline
|
|
No the other server is behind my router, it only has an internal IP adress, you can't access it from the outside world, so Apache would have to do some of its own rerouting to direct you from my main server to the "co" server.
|
|
|
|
|
|
|
|
|
Senior User
Join Date: Dec 2002
Location: Portland, OR
Status:
Offline
|
|
What you are looking for is a reverse (acceleration) proxy. You could run Squid in reverse proxy mode on your external machine and have it proxy the connections to the inside machine. I do this for a bunch of servers at work (I'm admin an internet facing datacenter.) It works great and Squid is solid as a rock.
It will have to be bound to a different port or IP than your Apache is currently running on though. The previous post mentions mod_proxy, I haven't used that, it might do something similar..
|
|
|
|
|
|
|
|
|
Grizzled Veteran
Join Date: Feb 2001
Location: Germany
Status:
Offline
|
|
You might also want to have a look at Pound: http://www.apsis.ch/pound/ -- we use it at my university (in fact, I administer Pound and the Apaches), runs nicely.
|
|
|
|
|
|
|
|
|
Ambrosia - el Presidente
Join Date: Sep 2000
Location: Rochester, NY
Status:
Offline
|
|
Originally posted by l008com:
No the other server is behind my router, it only has an internal IP adress, you can't access it from the outside world, so Apache would have to do some of its own rerouting to direct you from my main server to the "co" server.
I believe this would work:
Have your main (external) web server forward requests to your web site's domain to your router, on a special port (such as 8080) and then set up your router to portmap to your machine that sits behind it.
|
|
|
|
|
|
|
|
|
Mac Elite
Join Date: Sep 2000
Location: Edmond, OK USA
Status:
Offline
|
|
Originally posted by moki:
I believe this would work:
Have your main (external) web server forward requests to your web site's domain to your router, on a special port (such as 8080) and then set up your router to portmap to your machine that sits behind it.
I was going to mention something similar - we use our firewall to route traffic to different machines based on virtual IP's. It actually works very well and saves a lot of maintenance headache on the web servers (not to mention that any downtime on one server does not affect any other sites) in exchange for a little maintenance on the firewall.
|
|
|
|
|
|
|
|
|
Addicted to MacNN
Join Date: Jan 2000
Location: Stoneham, MA, USA
Status:
Offline
|
|
Originally posted by moki:
I believe this would work:
Have your main (external) web server forward requests to your web site's domain to your router, on a special port (such as 8080) and then set up your router to portmap to your machine that sits behind it.
Well yeah thats basically what i suggested in teh begining, but it'd be nice to be able to do it without having my site forward you to mysite.com:someoddportnumber
|
|
|
|
|
|
|
|
|
Professional Poster
Join Date: Nov 2000
Location: Tasmania, Australia
Status:
Offline
|
|
Originally posted by l008com:
No the other server is behind my router, it only has an internal IP adress, you can't access it from the outside world, so Apache would have to do some of its own rerouting to direct you from my main server to the "co" server.
As I said, isn't this what Apache's mod_proxy PassProxy / PassProxyReverse do?
See the documentation at:
ProxyPass & ProxyPassReverse
|
|
|
|
|
|
|
|
|
Addicted to MacNN
Join Date: May 2001
Status:
Offline
|
|
The answer is Yes.
DNS server.
|
|
|
|
|
|
|
|
|
Addicted to MacNN
Join Date: Jan 2000
Location: Stoneham, MA, USA
Status:
Offline
|
|
Originally posted by hyteckit:
The answer is Yes.
DNS server.
Wow what a great reply, thats answers all my questions, what more would I ever need to know with all that info.
|
|
|
|
|
|
|
|
|
Dedicated MacNNer
Join Date: May 2001
Location: Edinburgh, UK
Status:
Offline
|
|
You will have to run one of these servers on a different port. Only one task can be bound to a single port at once. Other than changing the port you need to do nothing else. I am however not sure how you change the port Apache runs on. The line
Port <port num>
in httpd.conf should do this. I am unsure how you would make your two instances of Apache to load httpd.conf files from different locations. Can this be done? If it can't I'm sure that there are some other web servers out there that support this. I wrote a simple multithreaded web server in Java a little while back that could do this.
|
|
|
|
|
|
|
|
|
Addicted to MacNN
Join Date: Jan 2000
Location: Stoneham, MA, USA
Status:
Offline
|
|
Changing the port is easy you on't need two copies of apache you can just do it within the virtual hosts. But I want two different machines, not just two different site, I already have 4 different sites.
|
|
|
|
|
|
|
|
|
Dedicated MacNNer
Join Date: May 2001
Location: Edinburgh, UK
Status:
Offline
|
|
Originally posted by l008com:
Changing the port is easy you on't need two copies of apache you can just do it within the virtual hosts. But I want two different machines, not just two different site, I already have 4 different sites.
That teaches me to not read the posts properly before replying...
Anyway someone mentioned you can do this with a DNS server. Well the most commonly used unix DNS server is the Berkeley Internet Name Domain or BIND. You should be able to easily find this with Google. Sorry I can't be of anymore help than that.
|
|
|
|
|
|
|
|
|
Addicted to MacNN
Join Date: Jan 2000
Location: Stoneham, MA, USA
Status:
Offline
|
|
Yeah I'm running OS X Server on my server now, and its DNS server IS running, for other reasons. How does it help me do this though?
I think if I run it on another machine on another port, I think I may be able to use modrewrite to change the url at pages are requested, I just don't know how. I think that is as close as I'm goona get though.
|
|
|
|
|
|
|
|
|
Mac Enthusiast
Join Date: Sep 2000
Location: Somewhere
Status:
Offline
|
|
Okay, let me make sure I understand this correctly. You have one machine that is currently your webserver. It's visible to the entire world on a public static IP. You also have a machine on your internal network that you want to be visible to the entire world, but you only have one public IP. Right?
The cleanest way to do that is to use Apache's ProxyPassReverse. (do a search for it in Apache's documentation). What it does is takes a virtual domain or a directory and proxies it to another server. E.g.
Request from client for http://www.mydomain.com/secondserver/ --> connects to www.mydomain.com (your primary server) --> primary server connects to secondary server, fetches pages, and sends them back to client
So everything is still going through your primary server as a proxy, but the pages are hosted on the second server.
The only way to leave the primary server out of the equation altogether is to run the secondary server on a different port, but like you said, it's kind of annoying having the port number in the address.
What you want to use depends on why you're setting up a second server. If you want to take some of the load off of the primary server, proxying won't do you any good, since with proxying the primary server still has to do work to serve from the secondary server. So if you're trying to distribute load, proxying isn't the answer.
On the other hand, if you're just running the second server for the convenience of having stuff hosted on a separate machine, proxying can help you.
I hope that answered your question.
|
|
|
|
|
|
|
|
|
Grizzled Veteran
Join Date: Nov 2001
Location: Oregon
Status:
Offline
|
|
|
|
|
|
|
|
|
|
|
Forum Regular
Join Date: Jan 2001
Status:
Offline
|
|
It sounds like you want packet forwarding with a domain name instead of port number. So, if I'm understanding you, you want your external server to continue to serve the four sites off that one IP and the fifth site on that IP to be off your internal server?
I guess you'll have to check if Apache if it can redirect requests to a certain domain to another server. If that's possible, you can have it forward the requests to that certain domain to your internal server (you might have to set up port forwarding on your router). If Apache can't do that, you may need to configure some other sort of packet filtering/forwarding on your server to point to your internal server and not use Apache to do that.
Check http://www.apache.org for some documentation on Apache.
|
There's never enough when you have too little
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Forum Rules
|
|
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|