老师,按照你的方法我安装了lua模块后检查了nginx配置语法出现nginx: [emerg] unknown directive “content_by_lua_file” in /usr/local/nginx/conf/nginx.conf:50这个报错
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
location /hello {
default_type 'text/plain';
content_by_lua_file 'ngx.say("hello, lua")';
}
location /myip {
default_type 'text/plain';
content_by_lua '
clientIP = ngx.req.get_headers()["x_forwarded_for"]
ngx.say("IP:",clientIP)
';
}
location / {
default_type "text/html";
content_by_lua_file /usr/local/nginx/conf/dep.lua;
#add_after_body "$http_x_forwarded_for";
}
#
location @server{
proxy_pass http://127.0.0.1:9090;
}
location @server_test{
proxy_pass http://127.0.0.1:8080;
}