if ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] )
&& preg_match( '/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/',
$_SERVER['HTTP_X_FORWARDED_FOR'] ) )
$_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_FORWARDED_FOR'];
if ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] )
&& preg_match( '/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/',
$_SERVER['HTTP_X_FORWARDED_FOR'] ) )
$_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_FORWARDED_FOR'];
Ja jāšķiro pēc ip adresēm tad – $remote_addr
http {
split_clients $echo_request_uri $c_host {
50% c1;
50% c2;
}
server {
location /data/ {
error_page 404 = /data/$c1.html;
error_page 403 = /data/$c1.html;
}
location ~* \.(txt|xml)${
add_header Access-Control-Allow-Origin *;
}
Ievieto iekš konkrētā server{}
location /home/domain1/ {
error_page 404 = /home/domain/error1.html;
error_page 403 = /home/picture.jpg;
}