Linux下Nginx+lua配置

前言:

这里我们使用OpenResty开源框架,它是一款基于 NGINX 和 LuaJIT 的 Web 平台。

1.官网下载OpenResty:

wget https://openresty.org/download/openresty-1.13.6.1.tar.gz

2.解压

tar -xzvf openresty-1.13.6.1.tar.gz

3.进入openresty-1.13.6.1文件夹,并执行:./configure

注意事项:这时可能会报错error: the HTTP rewrite module requires the PCRE library.

安装pcre-devel解决问题:yum -y install pcre-devel

错误:error: SSL modules require the OpenSSL library.

解决方法:yum -y install openssl openssl-devel


默认, --prefix=/usr/local/openresty 程序会被安装到/usr/local/openresty目录。

4. gmake && gmake install

5.配置环境变量

vim /etc/profile在文末添加:

PATH=/usr/local/openresty/nginx/sbin:$PATH

export PATH

6.启动nginx

vim /usr/local/openresty/nginx/conf/nginx.conf

在nginx.conf 文件中添加以下内容:

nginx配置

--启动:nginx

--停止:nginx -s stop

--重启:nginx -s reload

--检验nginx配置是否正确:nginx -t

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容