Nginx访问控制,测试admin.php是出现错误,不解何意,无头绪,求解

回复 收藏
nginx控制访问的时候,测试admin.php

使用浏览器测试没有问题:
023.png


使用curl测试,出现如下错误:
022.png

大家帮忙看看!!有什么思路吗?不知道出现什么错误啊!!!

配置文件为:
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;
    }

}





2016-06-11 04:57 举报
已邀请:
0

maria

赞同来自:

你配置里不是允许127.0.0.1了吗?
0

loveangeler

赞同来自:

location ~ .*admin\.php$ {
        allow 127.0.0.1;
        deny all;
只允许了本地……
0

阿铭 管理员

赞同来自:

测试的时候, -x 后面跟的IP一定要是你这台linux机器可以用ifconfig 查看到的IP。 在这台机器去curl访问你的真机以及另外一台linux,你觉得能得到结果么。
0

beafty

赞同来自:

loveangeler 发表于 2016-6-11 19:44
location ~ .*admin\.php$ {
        allow 127.0.0.1;
        deny all;

这个只是针对admin.php啊,,,
0

beafty

赞同来自:

maria 发表于 2016-6-11 08:42
你配置里不是允许127.0.0.1了吗?

哪个是针对admin.php的。。。
0

loveangeler

赞同来自:

beafty 发表于 2016-6-12 22:51
这个只是针对admin.php啊,,,

难道你不是curl的admin.php吗
0

beafty

赞同来自:

loveangeler 发表于 2016-6-13 08:29
难道你不是curl的admin.php吗

奥 shit,明白了,, 多谢。。。。!@!!

回复帖子,请先登录注册

退出全屏模式 全屏模式 回复
评分
可选评分理由: