name based hosting limiting

Scott Larson stl at wiredrive.com
Wed Sep 3 01:25:34 MSD 2008


      Is there a reason you're not using 'listen 80'?  That would bind  
to all your IPs and then you wouldn't need to do all the extra catch- 
all configurations.
-- 
Scott Larson
Network Administrator

Wiredrive
4216 3/4 Glencoe Ave
Marina Del Rey, CA 90292
t 310.823.8238
stl at wiredrive.com
http://www.wiredrive.com

On Sep 2, 2008, at 1:23 PM, Paul wrote:

> Igor, Scott..
> I have a whole bunch of server configurations on a whole lot of ip  
> addresses..
> Is there a way to specify the catch all for ALL the ip addresses or  
> would i have to do a server _ for every ip address?
> (I'm not using a 'listen 80;' but rather listen 1.1.1.1:80  
> 1.1.1.2:80 etc etc)
> Right now I'm using a if $host does not equal .*domain\.com.*,  
> proxy_pass http://127.0.0.1
> Thanks
>
> Igor Sysoev wrote:
>> On Tue, Sep 02, 2008 at 03:27:44PM -0400, Paul wrote:
>>
>>
>>> Is there a way to limit the domains that can be requested on a  
>>> server directive?
>>>
>>> Say I have
>>>
>>>   server
>>>       {
>>>               listen 2.2.2.2:80;
>>>               server_name x.com *.x.com;
>>>               location /
>>>               {
>>>                       proxy_pass http://1.1.1.1;
>>>                       proxy_redirect http://1.1.1.1/     http:// 
>>> $http_host/;
>>>                       proxy_redirect default;
>>>                       proxy_set_header        Host             
>>> $host;          ##Forwards host along
>>>                       proxy_set_header        X-Forwarded-For  
>>> $remote_addr;   ##Sends realip to customer svr
>>>               }
>>>       }
>>>
>>>
>>>
>>> Can I say, ONLY x.com and *.x.com can use this server?  Because I  
>>> can send any domain to it  and it passes it along to the backend  
>>> server.
>>> I would like to limit access to this.
>>>
>>
>>     server {
>>         listen 2.2.2.2:80 default;
>>         server_name  _;
>>         return 404;
>>     }
>>
>>     server {
>>         listen 2.2.2.2:80;
>>         server_name  x.com *.x.com;
>>
>>         # you may also add possibility to use IP only in browsers
>>         # and no Host header at all using:
>>         #server_name  2.2.2.2  "";
>>
>>         ...
>>     }
>>
>> Look also http://marc.info/?l=nginx&m=122025301723208&w=2
>>
>>
>>
>
> -- 
> GloboTech Communications
> Phone: 1-514-907-0050
> Toll Free: 1-(888)-GTCOMM1
> Fax: 1-(514)-907-0750
> paul at gtcomm.net
> http://www.gtcomm.net
>






More information about the nginx mailing list