** 官网:https://openresty.org/cn/**
Nginx OpenResty Tengine如何选择
模块对比
Openresty安装
yum 安装
下载官方预编译镜像包
wget https://openresty.org/package/centos/openresty.repo
mv openresty.repo /etc/yum.repos.d/
yum check-update
安装Openresty(默认路径)
yum install -y openresty-resty
二进制安装
- 安装依赖包
yum install readline-devel pcre-devel openssl-devel
- 官网(https://openresty.org/cn/)下载Openresty源码进行解压编译安装
wget https://openresty.org/download/ngx_openresty-1.9.7.1.tar.gz # 下载 tar xzvf ngx_openresty-1.9.7.1.tar.gz # 解压 cd ngx_openresty-1.9.7.1/ ./configure make make install
默认情况下程序会被安装到 /usr/local/openresty 目录,你可以使用 ./configure --help 查看更多的配置选项ddd
- 官网(https://openresty.org/cn/)下载Openresty源码进行解压编译安装
将openresty添加到系统服务
vi /etc/systemd/system/openresty.service
Unit]
Description=openresty - high performance web server
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
ExecStart=/usr/local/openresty/bin/openresty -c /usr/local/openresty/nginx/conf/nginx.conf
ExecReload=/usr/local/openresty/bin/openresty -s reload
ExecStop=/usr/local/openresty/bin/openresty -s stop
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl start openresty
systemctl enable openresty
Docker-compose部署openresty
Docker-compose
version: '2'
services:
openresty:
image: lianglm/openresty
container_name: openresty
volumes:
- /data/openresty/conf/conf:/usr/local/openresty/nginx/conf/conf.d
restart: always
ports:
- "8088:80"
environment:
TZ: Asia/Shanghai
目录/data/openresty/conf/conf为nginx配置文件,默认include文件为该目录下的*.conf