In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
1. Create a working directory
Mkdir openresty & & cd openresty2. Write a script that uses inotify to monitor configuration file changes and automatically reload auto-reload.sh:
#! / bin/shinotifywait-e modify,move,create,delete-mr-- timefmt'% d/%m/%y% HV% M'-- format'% T% f% e'\ / usr/local/openresty/nginx/conf/conf.d | while read event; do echo "$event" / usr/local/openresty/nginx/sbin/nginx-s reloaddone3. Write the image startup script start.sh:
#! / bin/bash/usr/bin/openresty-g "daemon off;" & / auto-reload.sh4. Write the configuration file nginx.conf:
User nobody;worker_processes auto;#worker_cpu_affinity 01 10 http workers are responsible for events {use epoll; worker_connections 6000;} http {include mime.types; default_type application/octet-stream; tcp_nodelay on Log_format main'$status $host $remote_addr $request_time -'$upstream_status $upstream_addr $upstream_response_time'[$time_local] $request'$bytes_sent $body_bytes_sent "$http_referer"'"$http_user_agent"$http_x_forwarded_for"' Access_log / usr/local/openresty/nginx/logs/access.log main; error_log / usr/local/openresty/nginx/logs/error.log; log_not_found off; sendfile on; keepalive_timeout 15; server_names_hash_bucket_size 4096; client_header_buffer_size 16k; large_client_header_buffers 4 64k; gzip on; gzip_http_version 1.0 Gzip_proxied expired no-cache no-store private auth; gzip_types text/plain application/x-javascript text/css application/xml text/javascript; gzip_min_length 1000; gzip_comp_level 5; gzip_buffers 48k; gzip_disable "MSIE [1-6]\. (?!. * SV1)"; include localenv.d/*.conf; include env.d/*.conf; include conf.d/*.backend.cfg Include conf.d/*.server.cfg; server {listen 80; server_name localhost; # access_log logs/host.access.log main; location / {root html; index index.html index.htm;} # error_page 404 / 404.html # redirect server error pages to the static page / 50x.html # error_page 500502503504 / 50x.htl; location = / 50x.html {root html;}} 5. Write a dockerfile:
FROM centos:7.6.1810 MAINTAINER openresty1.15.8.2 ADD auto-reload.sh auto-reload.shADD start.sh start.shRUN yum- y install epel-release & & yum install inotify-tools-y & & yum install-y yum-utils & & yum-config-manager-- add-repo https://openresty.org/package/centos/openresty.repo & & yum install-y openresty & & yum clean all & & chmod + x start.sh & & chmod + x auto-reload.shADD nginx.conf / usr/local / openresty/nginx/conf/nginx.confEXPOSE 80EXPOSE 443CMD [". / start.sh"] 6. Execute the docker build command:
Docker build-t openresty:1.15.8.2-f. / dockerfile. After the above command is executed, you can see the newly created openresty image through docker images.
7. Verify and run the container with the following command:
Docker run-itd-p 8080 data/logs:/usr/local/openresty/nginx/logs 80-v / data/logs:/usr/local/openresty/nginx/logs-v / data/nginx/conf.d:/usr/local/openresty/nginx/conf/conf.d openresty:1.15.8.2 adds or modifies the configuration file in the host directory / data/nginx/conf.d, and the openresty in the container will automatically reload, and the image will be created successfully.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.