Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a site in development, I want only my IP to access the website and block all other IPs. I could do that with allow 1.2.3.4 in Nginx and deny all. However I want other visitors to see just one page index.html which says:

Welcome to The site, Stay Tuned

how to make only one page accessible for global users like that in Nginx ?

I tried with error_page like

location / {
allow 1.2.3.4;
deny all;
error_page 403 index.html;
}

but this creates redirects and I get the website has too many redirects while accessing from other ip.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

You need to allow access to the error page in a matching location.

location = /error403.html {
    allow all;
}

location / {
    ....
    error_page 403 /error403.html;
}
share|improve this answer
    
thanks for prompt response... this is what i was looking for –  Jhilke Dai Mar 25 '13 at 17:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.