1. 啟動Docker
systemctl start docker
2. 查詢有沒有openresty鏡像
docker search openresty -s 30
-s 30 stars數大於30的
2. 拉取openresty鏡像
docker pull openresty/openresty
3. 執行鏡像,生成容器
docker run -it --name openresty -p 80:80 openresty/openresty /bin/bash
4. 發現這個鏡像里面沒有 yum ,導致很不方便,干脆自己來
5. 拉取centos,自己裝
docker pull centos
6. 執行容器
docker run -it --name centos-web -p 80:80 centos /bin/bash
7. 安裝Openresty
7.1 安裝前准備,在你的 CentOS 系統中添加 openresty 倉庫
yum install -y yum-utils
yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo
這個方法不行
7.2 安裝
yum install -y openresty
這個方法不行
7.3 安裝報錯,換一個方式(源碼包編譯安裝)裝
yum install -y wget
wget http://openresty.org/download/openresty-1.15.8.2.tar.gz
安裝一些要用到的開發庫
yum install pcre-devel openssl-devel gcc curl -y
tar -zxvf openresty-1.15.8.2.tar.gz
安裝perl
yum install perl*
配置
./configure --prefix=/opt/openresty --with-luajit --without-http_redis2_module --with-http_iconv_module
編譯並安裝
make
make install
7.4 啟動 Openresty
./nginx/sbin/nginx
7.5 查看運行docker 的機器的ip
瀏覽器訪問 http://ip:80/ 正常
