声明
此安装方式不是走yum安装,源码安装,要会一点linux基础
安装
安装前准备
源码下载:https://openresty.org/cn/download.html
要翻到下面 "源码发布"下的最新版
进入
/usr/local文件夹新建
[root@localhost ~]# cd /usr/local
[root@localhost local]# mkdir openResty
进入文件夹上传压缩包并解压
[root@localhost local]# cd openResty
[root@localhost openResty]# rz
[root@localhost openResty]# tar -zxf openresty-1.25.3.1.tar.gz
新建安装文件夹
[root@localhost openResty]# mkdir openrestyinstall
使用yum命令下载安装Lua和OpenResty所需的各种依赖。
[root@localhost openResty]# yum install libtermcap-devel ncurses-devel libevent-devel readline-devel pcre-devel gcc openssl openssl-devel per perl wget
配置OpenResty安装选项
./configure --prefix=/usr/local/openResty/openrestyinstall --with-luajit --without-http_redis2_module --with-http_stub_status_module --with-http_v2_module --with-http_gzip_static_module --with-http_sub_module
出现 (下面输出),表示成功
Configuration summary
+ using system PCRE library
+ using system OpenSSL library
+ using system zlib library
nginx path prefix: "/usr/local/openResty/openrestyinstall/nginx"
nginx binary file: "/usr/local/openResty/openrestyinstall/nginx/sbin/nginx"
nginx modules path: "/usr/local/openResty/openrestyinstall/nginx/modules"
nginx configuration prefix: "/usr/local/openResty/openrestyinstall/nginx/conf"
nginx configuration file: "/usr/local/openResty/openrestyinstall/nginx/conf/nginx.conf"
nginx pid file: "/usr/local/openResty/openrestyinstall/nginx/logs/nginx.pid"
nginx error log file: "/usr/local/openResty/openrestyinstall/nginx/logs/error.log"
nginx http access log file: "/usr/local/openResty/openrestyinstall/nginx/logs/access.log"
nginx http client request body temporary files: "client_body_temp"
nginx http proxy temporary files: "proxy_temp"
nginx http fastcgi temporary files: "fastcgi_temp"
nginx http uwsgi temporary files: "uwsgi_temp"
nginx http scgi temporary files: "scgi_temp"
cd ../..
Type the following commands to build and install:
gmake
gmake install
安装OpenResty
make install
进入安装后的文件夹,启动
[root@localhost openresty-1.25.3.1]# cd ../openrestyinstall/nginx/sbin
[root@localhost sbin]# ./nginx //启动
启动停止
[root@localhost bin]# /usr/local/openResty/openrestyinstall/bin/openresty -s stop //停止
[root@localhost bin]# /usr/local/openResty/openrestyinstall/bin/openresty //启动
查看
nginx是否启动
[root@localhost sbin]# ps -ef|grep nginx
打开80端口
[root@localhost openResty]# firewall-cmd --zone=public --permanent --add-port=80/tcp
[root@localhost openResty]# systemctl restart firewalld
浏览器打开,可以愉快的访问了
http://192.168.93.128/