[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

2 servers = 1 apache or 2?

Posted on 2004-10-26
5
Medium Priority
?
314 Views
Last Modified: 2010-03-04
I am working on a new FC2 box that will be splitting my websites and mail. But, I am a little confused about routing across my internal network.
I don't have a separate Proxy server ( yet ).

internet->Router->192.168.0.205 (main server box)

on 192.168.0.205 resides a current copy of Apache and ALL my websites and mail server. Now that I have a new server to add to my farm, 192.168.0.206, I want to route some websites that would be on 205 to 206.

would my httpd.conf file on 192.168.0.205 list
<virtual host 192.168.0.206/www/html/dir_of_site?>

I am looking for the syntax to route from 205 to 206.

Also, Would\Could I run a second copy of Apache on 206? Would this conflict?
I'm asking because I may want to migrate my 206 box to be the prime point, ie router->192.168.0.206, instead of the older 205

I hope I have been clear enough about what I am attempting.

Thanks, Frog
__________________
Curious by Nature,
Linux by Choice
0
Comment
Question by:DBA_Frog
  • 2
  • 2
5 Comments
 
LVL 15

Assisted Solution

by:samri
samri earned 500 total points
ID: 12413165
hi Frog,

It would depend on how your existing websites is currently built.

I would presume that you had several websites, and each had their own Vhost defined as (you mentioned in the text).

So, you had

<VirtualHost 192.168.0.205>
   ServerName  www.site1.com
   ...
</VirtualHost>
<VirtualHost 192.168.0.205>
   ServerName  www.othersite.com
   ...
</VirtualHost>

... and the list goes on.

if this is the case, I would suggest that you built the apache on 192,168.0.206 to be identical as those on 205, and defined the vhost the same as those on 205, except the Vhost container now

<VirtualHost 192.168.0.206>

And for those websites (on 205) that needs to be migrated, remove all directive, and replace it with the Proxy/ProxyPass directive

For example, if you want to move www.mysite.com from 205 to 206, then;

<VirtualHost 192.168.0.205>
  ServerName www.mysite.com
  ProxyPreserveHost On
  ProxyPass               /             http://192.168.0.206/
  ProxyPassReverse   /             http://192.168.0.206/
</VirtualHost>

Also good to enable ProxyPreserveHost to ensure that the request to Apache on 206 would still carry the "Host:" header for www.mysite.com, to ensure the Vhost matching is done correctly.

Some ref:
http://httpd.apache.org/docs-2.0/vhosts/
http://httpd.apache.org/docs-2.0/mod/mod_proxy.html
http://httpd.apache.org/docs-2.0/mod/mod_proxy.html#forwardreverse
http://httpd.apache.org/docs-2.0/mod/mod_proxy.html#examples
http://httpd.apache.org/docs-2.0/mod/mod_proxy.html#proxypreservehost

HTH.
0
 
LVL 5

Accepted Solution

by:
mrielf earned 500 total points
ID: 12413290
On 192.168.0.205 machine do this:

Turn on Proxy_module in apache
                    LoadModule proxy_module /usr/lib/apache/1.3/libproxy.so

Use VirtualHost section like this:

<VirtualHost x.x.x.x>
    ServerAdmin webmaster@server_on_206.com
    DocumentRoot /anything
    ServerName server_on_206.com
    ProxyRequests Off
    ProxyPass / http://server_on_206.com/
    ProxyPassReverse / http://server_on_206.com/
    ErrorLog /var/log/apache/server_on_206.com.log
    CustomLog /var/log/apache/server_on_206.com-access.log common
</VirtualHost>

Insert server information to host file:

192.168.0.206      server_on_206.com

On 192.168.0.206 Set up your servers....

0
 

Author Comment

by:DBA_Frog
ID: 12421594
Thank you both for the information.

mrielf: Once I load the module for Proxy_module, will that re-compile Apache?, I've read a little about modules in Apache and I want to make sure I don't have to do any additional steps after loading the module. Other than the obviouse reload of apache.

TIA for the info.
0
 
LVL 5

Expert Comment

by:mrielf
ID: 12422396
Of course you don't need to recompile apache, just restart it... (or reload configuration)
0
 

Author Comment

by:DBA_Frog
ID: 12422548
Again, Thank you both for your answers. Since they were very similar I split the points between the two of you.
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…
In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
There may be issues when you are trying to access Outlook or send & receive emails or due to Outlook crash which leads to corrupt or damaged PST file. To eliminate the corruption from your PST file, you need to repair the corrupt Outlook PST file. U…
Suggested Courses
Course of the Month7 days, 17 hours left to enroll

607 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question