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

你可能感兴趣的:(Linux下Nginx+lua配置)