My webserver has two ip(192.168.0.10 and 200.12.12.10).
And I have many hosts running on these ip.
most of them configured like this:
server {
server_name server1;
listen 80;
};
server {
server_name server2;
listen 80;
};
#…
Then I would like to make “server1” only listen to internal ip
address(192.168.0.10).
And I changed the server1 conf to
server {
server_name server1;
listen 192.168.0.10:80;
};
and keep everything else as before.
Now I got problem.
When I visit server2 using ip 192.168.0.10, the server will give me
response of server1.
Is there anyway to resolve this?
On Tue, Dec 11, 2012 at 12:54:06PM +0100, adam sun wrote:
Hi there,
When I visit server2 using ip 192.168.0.10, the server will give me
response of server1.
http://nginx.org/en/docs/http/request_processing.html
Is there anyway to resolve this?
Probably simplest is to list all of the desired listen addresses in each
server{} block.
(I don’t know if there’s a sensible way to have server1 just reject
any incoming requests to the “wrong” addresses – if so, that might be
an alternative.)
f
Francis D. [email protected]
On 11 December 2012 11:54, adam sun [email protected] wrote:
server {
server_name server1;
Is there anyway to resolve this?
Along with the IP-specific server{} blocks you’ve created, set up a
default server which doesn’t have an affinity to any site.
e.g.
server {
listen 192.168.0.10:80 default_server;
listen 200.12.12.10:80 default_server;
server_name _;
return 444; # or redirect, or whatever is appropriate
}
HTH
Jonathan
Jonathan M. // Oxford, London, UK
http://www.jpluscplusm.com/contact.html