Nginx下只针对logging.php进行https处理的重写规则 【转】

来源:互联网 发布:工控编程吧网址 编辑:程序博客网 时间:2024/06/03 18:21

文章出处:Nginx下只针对logging.php进行https处理的重写规则


在https server下加入如下配置:

if ($uri !~* "/logging.php$")
{
rewrite ^/(.*)$ http://$host/$1 redirect;
}

在http server下加入如下配置:

if ($uri ~* "/logging.php$")

{
rewrite ^/(.*)$ https://$host/$1 redirect;
}

最后结果就是,用户会且只会在访问logging.php的情况下,才会通过https访问。有效地避免了arp欺骗、嗅探等方法盗取账号密码的行为。


0 0