基于会话变量重定向NGINX

时间:2017-12-17 08:09:16

标签: php nginx

我正在尝试确定用户是否已使用NGINX登录,如果有,则将其重定向到网页,如果没有,则将其重定向到登录门户。为了做到这一点,我目前正在调用一个PHP页面来检查会话变量,如果它存在,我调用相同的子域来获取它们,这次使用NGINX可以检查的参数,我检查变量并重定向它们到正确的页面。目前无效。

server {
    listen 80;
    listen [::]:80;

    root /site/here/;

    index index.html index.php index.htm index.nginx-debian.html;

    server_name sub.domain.name www.sub.domain.name;

    location / {
            if ($arg_variable) {
                    proxy_pass https://domain.name:port;
            }
    }

    location ~ \.php$ {
            include fastcgi_params;
            include snippets/fastcgi-php.conf;
            fastcgi_param subdomain "docs";
            fastcgi_pass unix:/run/php/php7.0-fpm.sock;
    }

    location ~ /\.ht {
            deny all;
    }

}

0 个答案:

没有答案