openresty的安装及使用基于CentOS

【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部分:html

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服务,提示须要受权才能够登陆。nginx


【经常使用命令】
1.查看nginx加载的模块
./nginx/sbin/nginx -V
2.查看nginx加载的版本
./nginx/sbin/nginx -v


【源码安装】
#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.htmlcentos

相关文章
相关标签/搜索