参考文章中的openresty基本操作,进行实践时遇到了的问题。
1、启动nginx时提示
nginx: [emerg] unknown directive “content_by_lua” in ./nginx.conf:13
stackflow中一个说lua没有安装,一个说系统原来的nginx干扰
因为使用官方的openresty,所以前者的可能性不大。
which nginx
发现nginx的目录的确不是openresty下的。所以直接卸载系统的那个nginx
yum remove nginx
因为在 .bash_profile中将openresty下的nginx地址设置到了 $PATH 变量,所以直接
source .bash_profile
生效一下,然后重新启动nginx即可
2、启动nginx又遇到
nginx: [alert] could not open error log file: open() “./logs/error.log” failed (2: No such file or directory)
我并没有在nginx 目录下建立logs文件夹,所以应该是创建错误日志的失败了。在nginx目录下创建logs目录重启即可。