ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、视频、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
[TOC] ## 变量 ``` set $do_yaf 0; if ( $chic_ver = 3 ) { set $do_yaf 1; } ``` ## if https://www.xiaocan.me/nginx-if-multi-control/ 因为Nginx中的if语句不允许使用多条件判断,所以需要变通一下,使用变量作为中间值,然后判断这个变量: ``` set $do_yaf 0; if ( $chic_ver = 3 ) { set $do_yaf 1; } if (!-e $request_filename) { set $do_yaf "${do_yaf}1"; } if ( $do_yaf = "11" ) { rewrite ^/(.*)$ /index.php/$1 last; } location / { include /etc/nginx/conf.d/fastcgi_params; if ( $chic_ver = 2 ) { proxy_pass http://192.168.172.247:2332; break; } if ( $chic_ver = 3 ) { fastcgi_pass unix:/var/php-nginx/14774481332305.sock/socket; } } ```