[root@SERVER sbin]# nginx -V nginx version: nginx configure arguments: --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-http_spdy_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-ld-opt='-ljemalloc' [root@SERVER sbin]#vi nginx.conf user www www; worker_processes auto; error_log /home/wwwlogs/error_nginx.log crit; pid /var/run/nginx.pid; worker_rlimit_nofile 51200; events { use epoll; worker_connections 51200; } http { include blockip.conf; include mime.types; default_type application/octet-stream; server_names_hash_bucket_size 128; client_header_buffer_size 32k; large_client_header_buffers 4 32k; client_max_body_size 50m; sendfile on; tcp_nopush on; keepalive_timeout 120; server_tokens off; tcp_nodelay on; #Aliyun WAF set_real_ip_from 112.124.214.0/24; set_real_ip_from 42.121.40.0/22; real_ip_header X-Forwarded-For; real_ip_recursive on; /////////////////////////////////////////////////////////// [root@SERVER sbin]#vi /library/config.php #Aliyun WAF if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_FORWARDED_FOR']; }