Location ip filter , pass to CGI
September 23, 2011 05:12AM
Here is my config :

#Global

user www www;

#CPU Affinity / 4 worker - 4 cpu
worker_processes 4;

events {
worker_connections 2048;
}

http {
include mime.types;
default_type application/octet-stream;

index index.php index.html index.htm;

sendfile on;
tcp_nopush on;
keepalive_timeout 65;

server {
listen 80;
server_name xxxxxxxxxxxx;
root /usr/local/www/nginx/;

location / {
}

location ~ /www/admin/ {
allow 192.168.0.11;
deny all;
}

location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /usr/local/etc/nginx/fastcgi_params;
}

error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
}

When location ~ /www/admin/ is matched and allowed by 192.168.0.11 the second ~ \.php$ match in not reached resulting in displaying me the .php file , not sending it to fastcgi .

How should i make this work ? All i want is that http://xxxx/admin/www ( including subdirs and files ) to be reacheable only by ip 192.168.0.11 .

Thanks !
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 332
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready