Dockerfile部署openresty

本文介绍了如何在CentOS7系统上配置阿里yum源,安装必要的依赖,然后详细步骤安装OpenResty,设置环境变量,暴露端口并启动命令。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

FROM centos:centos7
MAINTAINER chen
ENV VERSION=1.19.9.1
# 配置阿里yum源
RUN cd /etc/yum.repos.d/ && yum install -y wget  && wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
#基础依赖
RUN yum install -y pcre-devel openssl-devel gcc postgresql-devel perl make
#RUN useradd nginx -s /sbin/nologin

#安装openresty
RUN wget https://openresty.org/download/openresty-${VERSION}.tar.gz && \
    mv openresty-${VERSION}.tar.gz /usr/local  &&  \
    tar -xzvf  /usr/local/openresty-${VERSION}.tar.gz -C /usr/local/ && cd /usr/local/openresty-${VERSION} &&  \
    ./configure --prefix=/usr/local/openresty \
	--sbin-path=/usr/local/openresty/nginx/sbin/nginx \
	--conf-path=/usr/local/openresty/nginx/conf/nginx.conf \
	--pid-path=/usr/local/openresty/nginx/run/nginx.pid \
	--error-log-path=/usr/local/openresty/nginx/logs/error.log \
	--http-log-path=/usr/local/openresty/nginx/logs/access.log \
	--user=nginx \
	--group=nginx \
	--with-pcre \
	--with-stream \
	--with-threads \
	--with-file-aio \
	--with-http_v2_module \
	--with-http_ssl_module \
	--with-http_realip_module \
	--with-http_gzip_static_module \
	--with-http_stub_status_module && cd /usr/local/openresty-${VERSION} && \
	make && make install


ENV PATH=$PATH:/usr/local/openresty/bin
WORKDIR /usr/local/openresty
EXPOSE 80 443
CMD ["/usr/local/openresty/bin/openresty", "-g", "daemon off;"]


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

java-superchen

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值