2012-10-02 6 views
0

는 내가 뭔가를 잘 리디렉션 다음Nginx에 내 IP 주소를 제외하고 재

location/{ 
    rewrite (.*) /sitedown.php redirect; 
    allow 94.12.147.139; 
    index index.html index.php; 
    try_files $uri $uri/ @handler; 
    expires 30d; 
} 

을 사용하여 "아래 사이트"는에, 내 IP 주소에서 떨어져 모든 사용자를 리디렉션 페이지를 할 노력하고있어 모든하지만 '수상 내 IP가 사이트에 액세스하는 것을 허용하지 마십시오. 어떤 도움이라도 감사 할 것입니다.

답변

0

다음 작업을해야합니다 :

location/{ 
    #this is the allow/deny/redirect bit 
    allow 94.12.147.139; 
    deny all; 
    error_page 403 sitedown.php; 

    #regular site config when not denied 
    index index.html index.php; 
    try_files $uri $uri/ @handler; 
    expires 30d; 
} 

location /sitedown.php {allow all;} 
+0

완벽한에 대해, 감사합니다! – jamessy

0

방법이

location/{ 

    if($remote_addr != Your Ip) { 
     rewrite^http://www.domain.com/sitedown.php; 
    } 

    index index.html index.php; 

    try_files $uri $uri/ @handler; 

    expires 30d; 

} 
관련 문제