如何在nginx.conf中解决“unknown directive rewrite_by_lua_block”错误?

当我在Ubuntu中运行nginx时使用命令:“service nginx start”它开始出现这个错误。有什么办法解决这个问题吗?

我尝试下载lua模块,因为我以为那可能是原因,但它没有起作用。我不知道我是不是下载错了或者那不是问题。

//nginx.conf文件:

worker_processes  auto;

events {
worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;
    server {
        listen       8080;
        server_name  localhost;

        location / {
           proxy_pass http://127.0.0.1:1234;
        }
        location ~* \.css$ {
            rewrite_by_lua_block {
               local new_uri = ngx.re.sub(ngx.var.uri , ".*/([a-z0-9.-]+.css$)", "/$1" , "mijo")
            ngx.req.set_uri(new_uri)
    ngx.log(ngx.ERR , ngx.var.uri ,  " " , new_uri)
        }
        root html;
        }
    }

}

你有什么办法可以启动程序吗?

点赞