猿问

nginx根据不同ip请求不同文件配置

    location / {

        if ($remote_addr ~ "120.11.74.18")

            {

                alias $rootdir1;

                 break;

            }

        alias $rootdir2;

    }

nginx: [emerg] "alias" directive is not allowed here in /home/rocky/nginx/conf.d/test.conf:14
nginx: configuration file /home/rocky/nginx/conf/nginx.conf test failed

米脂
浏览 1126回答 1
1回答

qq_笑_17

用变量location / {        set $rootdir "path/to/a";        if ($remote_addr ~ "120.11.74.18")            {                set $rootdir "path/to/b";            }        alias $rootdir;    }
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答