I am trying to create basic hello word page in OpenResty. It works fine if I use content_by_lua, however when I trying to use content_by_lua_file I've got this error:
2015/01/22 13:52:35 [alert] 2183#0: lua_code_cache is off; this will hurt performance in /Users/lobster/documents/web_server/conf/nginx.conf:10
2015/01/22 13:52:38 [error] 2223#0: *4 failed to load external Lua file "/Users/lobster/documents/web_server/./lua/main.lua": cannot open /Users/lobster/documents/web_server/./lua/main.lua: Permission denied, client: 127.0.0.1, server: , request: "GET / HTTP/1.1", host: "localhost:8080"
But it doesn't have sense, because I can change /Users/lobster/documents/web_server/lua/main.lua file easily. There is my config:
worker_processes 1;
error_log logs/error.log;
events {
worker_connections 1024;
}
http {
lua_package_path '/lua/main.lua;';
server {
lua_code_cache off;
listen 8080;
location / {
default_type 'text/plain';
content_by_lua_file ./lua/main.lua;
}
}
}
I start nginx from root, so nginx can access any file on my computer. What I did wrong?
UPD: I fixed it using content_by_lua with require inside it