Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

how to block a particular URL in nginx

$
0
0
Hi,

I have a nginx conf file in which i want to block this particular url example-xyz.com.

I have added the following lines in my conf file.

server {
port_in_redirect off;
server_tokens off;
if ($http_host$request_uri != 'example-xyz.com') {
return 403;
break;
}
listen 80;
}

But this is not working, everytime i hit this url in my browser, it is opening fine.
Ideally it should return access forbidden.

Any suggestions.

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>