準備工作
如果安裝的linux能夠聯網,並且外部也能正常使用linux的端口,那麼可以忽略下面兩部
1 .設定自動取得ip
(1)在linux上輸入指令
[root@localhost ~]ip addr #查看ip [root@localhost ~]nmcli connection show
可以查看目前網路卡資訊
[root@localhost ~]vi /etc/sysconfig/network-scripts/ifcfg-ens33
[root@localhost ~]# systemctl restart network
2.關閉防火牆
systemctl stop firewalld.service #停止firewall systemctl disable firewalld.service #禁止firewall开机启动
3.準備安裝是發現沒有wget指令,可以先依照線面安裝如果下面提示沒有wget指令時,可以執行這一步驟
[root@localhost ~]#yum -y install wget
#安裝
1.安裝依賴環境
[root@localhost ~]#yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel
2.安裝luajit
[root@localhost luajit]#wget http://luajit.org/download/luajit-2.0.2.tar.gz [root@localhost luajit]#tar –xvf luajit-2.0.2.tar.gz [root@localhost luajit]#cd luajit-2.0.2 [root@localhost luajit-2.0.2]#make install
#3.安裝nginx
[root@localhost nginx]#wget https://github.com/simpl/ngx_devel_kit/archive/v0.3.0.tar.gz [root@localhost nginx]#wget https://github.com/openresty/lua-nginx-module/archive/v0.10.9rc7.tar.gz [root@localhost nginx]#wget http://nginx.org/download/nginx-1.12.1.tar.gz #注意下载后的压缩包没有文件名称,但是根据版本号能区分是哪个文件 [root@localhost nginx]#tar -xvf v0.3.0.tar.gz [root@localhost nginx]#tar -xvf v0.10.9rc7.tar.gz [root@localhost nginx]#tar -xvf nginx-1.12.1.tar.gz
[root@localhost nginx]# cd nginx-1.12.1 [root@localhost nginx-1.12.1]#./configure --prefix=/usr/local/nginx --add-module=../ngx_devel_kit-0.3.0 --add-module=../lua-nginx-module-0.10.9rc7
[root@localhost nginx-1.12.1]#make [root@localhost nginx-1.12.1]#make install
./nginx: error while loading shared libraries: libluajit-5.1.so.2: cannot open shared object file: n找不到libluajit-5.1 .so.2這個檔案
[root@localhost nginx-1.12.1]#find / -name libluajit-5.1.so.2
[root@localhost nginx-1.12.1]#cp /usr/local/lib/libluajit-5.1.so.2 /usr/lib64/ [root@localhost nginx-1.12.1]#cp /usr/local/lib/libluajit-5.1.so.2.0.2 /usr/lib64
location /hello{ default_type 'text/plain'; content_by_lua 'ngx.say("hello,lua")'; }
啟動nginx
[root@localhost nginx-1.12.1]#./configure
以上是Centos7安裝Nginx整合Lua的方法的詳細內容。更多資訊請關注PHP中文網其他相關文章!