Closed rming closed 8 years ago
Are you doing it as root? Try sudo /etc/init.d/nginx reload
Hey, I got the same problem before. And this is because sailor.lua cannot get the ROOT PATH sent by Nginx. I fixed it by these steps:
-- Stores the path of the application in sailor.path
function sailor.set_application_path(r)
local dir = lfs.currentdir()
if dir == '/' or not dir then
local filename = r.uri:match( "([^/]+)$")
sailor.path = r.filename:match("^@?(.-)/"..filename.."$")
elseif r.document_root then
sailor.path = r.document_root
else
sailor.path = dir
end
end
It works.
And this is my lua.conf:
server {
listen 80;
server_name lua.xwg.cc;
root /webroot/api/;
location / {
lua_need_request_body on;
lua_code_cache off;
content_by_lua_file /webroot/api/index.lua$1;
index index.lua index.lp;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 1h;
}
}
vhost.conf
error.log
It seems the web root was changed while reloading nginx configration with my nginx startup script.
/etc/ini.d/nginx reload
It woks well when I use
nginx -s reload
to relod nginx.