在centos系统中我遇到了这样的报错请问是什么原因:Stoping nginx nginx emerg unknown directive lua_package_path in usrlocalnginxconfnginxconf30 failed Use force-quitTerminating nginx doneStarting nginx nginx emerg unknown d
这个报错提示是因为在你的nginx配置文件中有一个未知的指令"lua_package_path"。这个指令可能是某个模块添加的,但是你的nginx并没有安装这个模块,所以无法识别这个指令。
解决方法是安装相应的模块或者修改配置文件,将这个指令注释掉或者删除掉。
如果你确定需要这个模块,可以通过以下步骤安装:
- 安装依赖
yum install -y gcc make zlib-devel pcre-devel openssl-devel
- 下载lua模块
wget https://github.com/openresty/lua-nginx-module/archive/v0.10.15.tar.gz tar -xzvf v0.10.15.tar.gz
- 下载luaJIT
wget https://github.com/openresty/luajit2/archive/v2.1-20200102.tar.gz tar -xzvf v2.1-20200102.tar.gz
- 编译安装
cd luajit2-2.1-20200102/ make && make install
cd /usr/local/src/nginx-1.14.0/
./configure --prefix=/usr/local/nginx
--with-http_ssl_module
--with-http_v2_module
--with-ld-opt="-Wl,-rpath,/usr/local/lib"
--add-module=/usr/local/src/lua-nginx-module-0.10.15
make && make install
- 修改nginx配置文件
在nginx.conf文件中添加以下两行:
lua_package_path "/usr/local/src/lua-resty-auto-ssl-master/lib/?.lua;;"; lua_ssl_trusted_certificate /etc/resty-auto-ssl/root_cert.pem;
- 重启nginx
systemctl restart nginx
注意,这里的路径和模块版本可能需要根据实际情况进行调整
原文地址: http://www.cveoy.top/t/topic/fsXP 著作权归作者所有。请勿转载和采集!