前言
本人的使用的電腦是Mac,操作系統是macOS Mojave。電腦上裝有虛擬機。
虛擬機上安裝Centos7操作系統,在其之上安裝Nginx及Luau類庫,整個過程是在系統安裝完成之后開始記錄。
建議安裝前先拍快照,出現問題可以恢復
準備工作
如果安裝的Linux能夠聯網,并且外部也能正常使用Linux的端口,那么可以忽略下面兩部
1.設置自動獲取ip
(1)在Linux上輸入命令
[root@localhost ~]ip addr #查看ip[root@localhost ~]nmcli connection show
可以查看當前網卡信息
我的是 ens33
(2)修改信息
[root@localhost ~]vi /etc/sysconfig/network-scripts/ifcfg-ens33
將最后一行ONBOOT=no 修改為 ONBOOT=yes
(3)重啟網絡服務
[root@localhost ~]# systemctl restart network
2.關閉防火墻
systemctl stop firewalld.service #停止firewallsystemctl 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
我是在/usr/local路徑下創建了 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
(1)下載ngx_devel_kit、lua-nginx-module、nginx
我是在/usr/local路徑下創建了 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
(2)編譯Nginx
[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
(3)安裝
新聞熱點
疑難解答