Nginx网站架构实战——17、centos6.5部署nginx+Lua环境

网友投稿 747 2023-03-09

本站部分文章、图片属于网络上可搜索到的公开信息,均用于学习和交流用途,不能代表睿象云的观点、立场或意见。我们接受网民的监督,如发现任何违法内容或侵犯了您的权益,请第一时间联系小编邮箱jiasou666@gmail.com 处理。

Nginx网站架构实战——17、centos6.5部署nginx+Lua环境

1、系统基础信息

 [root@tiejiang-src1 ~]# ifconfig eth0|grep 'inet addr'|awk -F ":" '{print $2}'|awk '{print $1}'    192.168.83.129[root@tiejiang-src1 ~]# cat /etc/redhat-release    CentOS release 6.5 (Final)[root@tiejiang-src1 ~]# uname -r    2.6.32-431.el6.x86_64

[root@-src1 ~]# ifconfig eth0|grep 'inet addr'|awk -F ":" '{print $2}'|awk '{print $1}' 192.168.83.129[root@-src1 ~]# cat /etc/redhat-release CentOS release 6.5 (Final)[root@-src1 ~]# uname -r 2.6.32-431.el6.x86_64

2、安装配置步骤

 [root@tiejiang-src1 ~]# yum -y install gcc gcc-c++[root@tiejiang-src1 ~]# yum -y install openssl openssl-devel

[root@-src1 ~]# yum -y install gcc gcc-c++[root@-src1 ~]# yum -y install openssl openssl-devel

3、创建Nginx运行的普通用户

4、下载需要的程序并安装

安装LuaJIT Luajit是Lua即时编译器

 [root@tiejiang-src1 src]# tar zxvf LuaJIT-2.0.4.tar.gz[root@tiejiang-src1 LuaJIT-2.0.4]# cd /usr/local/src/LuaJIT-2.0.4[root@tiejiang-src1 LuaJIT-2.0.4]# make && make install

[root@-src1 src]# tar zxvf LuaJIT-2.0.4.tar.gz[root@-src1 LuaJIT-2.0.4]# cd /usr/local/src/LuaJIT-2.0.4[root@-src1 LuaJIT-2.0.4]# make && make install

安装nginx并加载模块

安装完毕后,下面可以测试安装了,修改nginx.conf 增加第一个配置

 [root@tiejiang-src1 nginx-1.9.4]# cd /usr/local/nginx/conf/[root@tiejiang-src1 conf]# cp nginx.conf nginx.conf.bak[root@tiejiang-src1 conf]# vim nginx.conf        server {            listen       80;            server_name  localhost;                #charset koi8-r;                #access_log  logs/host.access.log  main;                 location /hello {                    default_type 'text/plain';                    content_by_lua 'ngx.say("hello,lua")';            }                        error_page   500 502 503 504  /50x.html;            location = /50x.html {            root   html;        }    }[root@tiejiang-src1 conf]# /usr/local/nginx/sbin/nginx -t    nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok    nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful[root@tiejiang-src1 conf]# /usr/local/nginx/sbin/nginx

[root@-src1 nginx-1.9.4]# cd /usr/local/nginx/conf/[root@-src1 conf]# cp nginx.conf nginx.conf.bak[root@-src1 conf]# vim nginx.conf server { listen 80; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location /hello { default_type 'text/plain'; content_by_lua 'ngx.say("hello,lua")'; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } }[root@-src1 conf]# /usr/local/nginx/sbin/nginx -t nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful[root@-src1 conf]# /usr/local/nginx/sbin/nginx

上一篇:openresty实现WAF功能
下一篇:Attach Volume 操作(Part I) - 每天5分钟玩转 OpenStack(53)
相关文章

 发表评论

暂时没有评论,来抢沙发吧~