restrict sub-directory access divert if not authenticated

jacograaff nginx-forum at
Mon Mar 16 05:11:33 UTC 2015

I am moving from a development server to a live server and would like to
still test before REALLY going live.

I need to redirect access to a sub-folder until I am satisfied with the

 this is what i have:
server {
    listen 80;

    #other configurations

    location ~ \.php$ {
        #fastcgi configurations 

# now for the new sub-site

    location /shop/ {
        # I would like to redirect to ShopSoonToOpenAdvertisement.html if
       satisfy any;
       allow; # my testing server and some client's ip's for
       deny all;
       auth_basic "sorry but this page is off limits - please go back to <a
       auth_basic_user_file /etc/nginx/.htpasswd;


for this config the server does not allow access to


will render the page sans the .js, css, etc...

I would like to show the shop if passw or allow is satisfied else redirect
to a static html file

Any suggestions??

Posted at Nginx Forum:,257266,257266#msg-257266

More information about the nginx mailing list