Dockerfile 构建kibana 反向代理应用做用户认证访问

FROM centos
MAINTAINER z*****ch.cn

RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone

RUN rm -f /etc/nginx/nginx.conf
COPY nginx.conf /etc/nginx/nginx.conf


WORKDIR /
 
RUN mkdir data

ADD nginx.repo /etc/yum.repos.d
RUN yum install nginx -y
RUN echo "daemon off;" >> /etc/nginx/nginx.conf

RUN rm -rf /etc/nginx/conf.d/default.conf

ADD kibana_prod.conf /etc/nginx/conf.d/
ADD htpasswd /etc/nginx/conf.d/

RUN useradd -s /sbin/nologin -M www
EXPOSE 80
CMD ["nginx"]

  

cat kibana_prod.conf 
server {

     listen 8000;
     server_name localhost;

     location / {
          auth_basic "kibana auth";
          auth_basic_user_file /etc/nginx/conf.d/htpasswd;
          proxy_pass http://192.168.0.139;
          proxy_redirect off;
          proxy_set_header Host $host;
          proxy_set_header X-Real-IP $remote_addr;
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                }
      }

  

cat htpasswd 
weifneg:$apr1$NU.QYqDz$2KWHmJaztvaSUD0tuRxnC0

  

posted @ 2019-03-07 10:55  Oops!#  阅读(494)  评论(0编辑  收藏  举报