Re: two servers and sites on single IP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



mod_proxy is the standard approach here..

Set up a second vhost on 192.168.0.1 and get that to proxy back to 192.168.0.2

You will need to specify a small folder as doc root - basically to serve error pages! - our error directory has static pages for each error message we wont to handle + css/images

DocumentRoot /www/place-to-put-error-pages
<VirtualHost *:443>
  ServerName                  foo.bar.com
  RewriteEngine               on
  ProxyPreserveHost           on
  ProxyPassReverse            / http://192.168.0.2/
  RewriteCond %{REQUEST_URI}  !^/errors
  RewriteRule (.*) http://192.168.0.2$1          ; [P,L]
  ErrorDocument 403           /errors/foo.html
  ErrorDocument 500           /errors/foo.html
  ErrorDocument 502           /errors/foo.html
  ErrorDocument 503           /errors/foo.html
</VirtualHost>

To be honest I use this set up on a single box with a lightweight frontend that serves errors and a heavyweight backend which servers dynamic sites - so that when I need to restart the later (which can take 2/3 seconds) we don't lose requests. The front end apache restarts really quickly because it is quite small...


On 29/06/2018 16:27, Louis wrote:
On 2018-06-29 10:26 AM, Jerry Arnold wrote:
Does bar.me.com have to run on 192.168.0.2?  There is no reason you can't run multiple domains on the same IP

Thanks -- but yes; two separate boxes with different o/s.

I have tried setting up a new "bar.conf" on"foo" -- but am having difficulties with directory root:

me@foo:/etc/apache2/sites-available$ apachectl -S
AH00112: Warning: DocumentRoot [/etc/apache2/192.168.0.2/usr/share/bar] does not exist
VirtualHost configuration:
192.168.0.2:80        bar.me.com (/etc/apache2/sites-enabled/bar.conf:1)
192.168.0.1:80        k318 (/etc/apache2/sites-enabled/k318.conf:6)
192.168.0.31:*        k318-admin (/etc/apache2/sites-enabled/k318-admin.conf:3)


Louis


https://httpd.apache.org/docs/2.4/vhosts/examples.html

VirtualHost Examples - Apache HTTP Server Version 2.4 <https://httpd.apache.org/docs/2.4/vhosts/examples.html>
httpd.apache.org
Your server has multiple hostnames that resolve to a single address, and you want to respond differently for www.example.com and www.example.org. The above configuration is what you will want to use in almost all name-based virtual hosting situations. The only thing that this configuration will not ...

For https you can use SNI:


https://wiki.apache.org/httpd/NameBasedSSLVHostsWithSNI

NameBasedSSLVHostsWithSNI - Httpd Wiki <https://wiki.apache.org/httpd/NameBasedSSLVHostsWithSNI>
wiki.apache.org
SSL with Virtual Hosts Using SNI. Summary. Using name-based virtual hosts with SSL adds another layer of complication. Without the SNI extension, it's not generally possible (though a subset of virtual host might work).





Jerry Arnold
Principal Engineer/Architect II
o: 1-913-663-9522


------------------------------------------------------------------------
*From:* Louis <stormy22@xxxxxxxxx>
*Sent:* Friday, June 29, 2018 9:15:19 AM
*To:* Apache list
*Subject:*  two servers and sites on single IP
Hopefully simple, but I'm now getting confused.  Currently, single
server1 192.168.0.1 (Apache 2.4) running single site foo.me.com on
single static IP. Rock solid for the last six years.

Need to add server2 192.168.0.2 (Apache 2.4) for site bar.me.com on the
same static IP.

What is the fastest, most efficient way for server1 to rewrite |
redirect | proxy  "bar" to 192.168.0.2 and still serve "foo" from
192.168.0.1? (Border router does not accept alpha commands, only
numerical, so I cannot redirect here.)

Many thanks -- Louis

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


------------------------------------------------------------------
This email is intended solely for the use of the
addressee and may contain information that is
confidential, proprietary, or both. If you receive
this email in error please immediately notify
the sender and delete the email.
------------------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx




--
The Wellcome Sanger Institute is operated by Genome Research Limited, a charity registered in England with number 1021457 and a company registered in England with number 2742969, whose registered office is 215 Euston Road, London, NW1 2BE.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx




[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux