Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nginx-1.12.0 配置文件转到 tengine-2.2.2兼容问题 #1019

Closed
moqianjun opened this issue Mar 6, 2018 · 4 comments
Closed

nginx-1.12.0 配置文件转到 tengine-2.2.2兼容问题 #1019

moqianjun opened this issue Mar 6, 2018 · 4 comments

Comments

@moqianjun
Copy link

    if ($uri ~* "&openId=([^\/]+)&" ){
    set $openid $1;
    }

上面的配置拷贝到tengine 下面 -t 的时候报
nginx: [emerg] unknown directive "if" in /usr/local/nginx/conf/nginx.conf:150

@wangfakang
Copy link
Collaborator

@moqianjun 请提供完整的nginx配置信息,我本地没有复现你说的问题。

@moqianjun
Copy link
Author

moqianjun commented Mar 26, 2018

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;
    }

@moqianjun
Copy link
Author

我是换了一个配置文件,这回是 nginx: [emerg] unknown directive "if" in /usr/local/nginx/conf/conf.d/test.conf:28

@chobits
Copy link
Member

chobits commented Mar 28, 2019

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 #1220.

@chobits chobits closed this as completed Mar 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants