一、安装依赖
yum install pcre-devel openssl-devel gcc curl postgresql-devel
二、下载
wget -c https://openresty.org/download/openresty-1.15.8.1rc2.tar.gz
三、解压
tar -zxvf openresty-1.15.8.1rc2.tar.gz
四、源码编译
// 切换目录
cd openresty-1.15.8.1rc2/
// 开始安装
./configure。
五、添加环境变量
vim /etc/profile
PATH=/usr/local/openresty/nginx/sbin:$PATH
export PATH
// 保存退出
六、执行生效命令 查看是否生效:
source /etc/profile
echo $PATH
七、添加仓库执行命令
yum install yum-utils
yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo
八、执行安装
yum install openresty
// 安装成功 则生成在默认目录 /usr/local/openresty
九、配置nginx
默认已经安装好了nginx,在目录:/usr/local/openresty/nginx 下。
修改/usr/local/openresty/nginx/conf/nginx.conf ,将配置文件使用的根设置为root
#user nobody; 配置文件第一行原来为这样, 现改为下面的配置
user root root;
十、启动nginx
sbin/nginx -c conf/nginx.conf
十一、直接浏览器访问
直接浏览器访问