nginx控制访问的时候,测试admin.php
使用浏览器测试没有问题:
使用curl测试,出现如下错误:
大家帮忙看看!!有什么思路吗?不知道出现什么错误啊!!!
配置文件为:
server
{
listen 80;
server_name www.test.com www.aaa.com;
if ($host != 'www.test.com')
{
rewrite ^/(.*)$ http://www.test.com/$1 permanent;
}
index index.html index.htm index.php;
root /data/www;
access_log /tmp/access.log combined_realip;
location ~ .*admin\.php$ {
allow 127.0.0.1;
deny all;
include fastcgi_params;
fastcgi_pass unix:/tmp/php-fcgi.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /data/www$fastcgi_script_name;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
access_log off;
expires 15d;
valid_referers none blocked *.test.com *.aaa.com;
if ($invalid_referer)
{
return 403;
}
}
location ~ \.(js|css)
{
access_log off;
expires 2h;
}
location ~ (static|cache)
{
access_log off;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass unix:/tmp/php-fcgi.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /data/www$fastcgi_script_name;
}
}
使用浏览器测试没有问题:
使用curl测试,出现如下错误:
大家帮忙看看!!有什么思路吗?不知道出现什么错误啊!!!
配置文件为:
server
{
listen 80;
server_name www.test.com www.aaa.com;
if ($host != 'www.test.com')
{
rewrite ^/(.*)$ http://www.test.com/$1 permanent;
}
index index.html index.htm index.php;
root /data/www;
access_log /tmp/access.log combined_realip;
location ~ .*admin\.php$ {
allow 127.0.0.1;
deny all;
include fastcgi_params;
fastcgi_pass unix:/tmp/php-fcgi.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /data/www$fastcgi_script_name;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
access_log off;
expires 15d;
valid_referers none blocked *.test.com *.aaa.com;
if ($invalid_referer)
{
return 403;
}
}
location ~ \.(js|css)
{
access_log off;
expires 2h;
}
location ~ (static|cache)
{
access_log off;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass unix:/tmp/php-fcgi.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /data/www$fastcgi_script_name;
}
}
0
这个只是针对admin.php啊,,,
loveangeler 发表于 2016-6-11 19:44
location ~ .*admin\.php$ {
allow 127.0.0.1;
deny all;
这个只是针对admin.php啊,,,
编辑回复