【yum安装】
(网速的原因,可能会失败,多试几次)
#yum install yum-utils
#yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo
#yum install openresty
默认会安装到/usr/local/openresty/ 这个目录下
**************yum方式安装至此完***************
【配置账号密码登录auth_basic_user_file】
用htpasswd 生成登录秘钥文件:
# htpasswd -bc pw.db aaa bbb
用户名为aaa密码为bbb生成的秘钥文件为pw.db
nginx中配置如下,见auth_basic部分:
location / {
root html;
index index.html index.htm;
auth_basic "secure1";
auth_basic_user_file /usr/local/openresty/nginx/pw.db;
}
#/usr/local/openresty/nginx/sbin/nginx -t
#/usr/local/openresty/nginx/sbin/nginx -s reload
此时方位刚刚搭建好的nginx服务,提示需要授权才可以登录。
【源码安装】
#wget https://openresty.org/download/openresty-1.15.8.1.tar.gz
#tar -xzvf openresty-VERSION.tar.gz
#cd openresty-1.15.8.1/
#./configure --prefix=/opt/openresty
#make
#make install
【官网】
http://openresty.org/cn/download.html