server { listen 8080; server_name localhost; root html; location /search/ { if ( $remote_addr = "192.168.184.1" ) { return 200 "test if OK in URL /search/"; } } location / { if ( $uri = "/images/" ) { rewrite (.*) /pics/ break; } return 200 "test if failed\n"; } location /test/ { } }