0
if ($uri ~* "&openId=([^\/]+)&" ){
set $openid $1;
}
上面的配置拷贝到tengine 下面 -t 的时候报 nginx: [emerg] unknown directive "if" in /usr/local/nginx/conf/nginx.conf:150
if ($uri ~* "&openId=([^\/]+)&" ){
set $openid $1;
}
上面的配置拷贝到tengine 下面 -t 的时候报 nginx: [emerg] unknown directive "if" in /usr/local/nginx/conf/nginx.conf:150
@moqianjun 请提供完整的nginx配置信息,我本地没有复现你说的问题。
server {
listen 80;
listen 443 ssl;
server_name www.abc.com;
location / {
if ( $request_uri ~* news\/[0-9]+\.html ) {
rewrite /news/([0-9]+)\.html /news/content.do?id=$1 break;
}
if ( $request_uri ~* content\/[0-9]+\.html ) {
rewrite /content/([0-9]+)\.html /news/fetchContent.do?id=$1 break;
}
proxy_pass http://test_tengine/;
proxy_http_version 1.1;
proxy_set_header Connection "";
}
root html;
index index.html index.htm;
}
我是换了一个配置文件,这回是 nginx: [emerg] unknown directive "if" in /usr/local/nginx/conf/conf.d/test.conf:28
server {
listen 80;
listen 443 ssl;
server_name www.abc.com;
location / {
if ( $request_uri ~* news\/[0-9]+\.html ) {
rewrite /news/([0-9]+)\.html /news/content.do?id=$1 break;
}
if ( $request_uri ~* content\/[0-9]+\.html ) {
rewrite /content/([0-9]+)\.html /news/fetchContent.do?id=$1 break;
}
proxy_pass http://test_tengine/;
proxy_http_version 1.1;
proxy_set_header Connection "";
}
root html;
index index.html index.htm;
}
This configuration test is successful is tengine 2.3.0, please try it.
Tengine-2.3.0 has been released, it has been been upgraded to nginx 1.15.9.
For more details of new version, see https://github.com/alibaba/tengine/issues/1220.