Advertisement
METAJIJI

Cloudflare nginx allow/deny

Nov 11th, 2015
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nginx 0.55 KB | None | 0 0
  1. # WARNING: log_format must be in http {}.
  2. # http://nginx.org/en/docs/http/ngx_http_core_module.html#var_http_
  3. log_format cloudflare '$http_cf_connecting_ip - $remote_user [$time_local] "$request" '
  4.     '$status $body_bytes_sent "$http_referer" '
  5.     '"$http_user_agent" "$http_x_forwarded_for"';
  6. server {
  7.     ...
  8.     #!!!DO NOT USE!!! set_real_ip_from & real_ip_header;
  9.     allow 1.1.1.1;  # Cloudflare front ip1.
  10.     allow 1.1.1.2;  # Cloudflare front ip2.
  11.     deny all;
  12.     ...
  13.  
  14.     location /application {
  15.         fastcgi_param REMOTE_ADDR $http_cf_connecting_ip;
  16.         ....
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement