nginx-reloader

command module
v0.0.0-...-8c2a60d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 28, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

README

nginx-reloader

用于监听Nginx配置变化,自动reload Nginx
可以监听指定的目录及其子目录的变化
示例:

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      name: nginx
      labels:
        app: nginx
    spec:
      shareProcessNamespace: true
      containers:
        - name: nginx
          image: nginx
          imagePullPolicy: IfNotPresent
          volumeMounts:
            - name: nginx-config
              mountPath: /etc/nginx/conf.d
              readOnly: true           
        - name: nginx-reloader
          image: registry.cn-hangzhou.aliyuncs.com/rookieops/nginx-reloader:v2
          imagePullPolicy: IfNotPresent
          env:
            - name: WATCH_NGINX_CONF_PATH
              value: /etc/nginx
          volumeMounts:
          - name: nginx-config
            mountPath: /etc/nginx/conf.d
            readOnly: true
      volumes:
      - name: nginx-config
        configMap:
          name: nginx-config
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: nginx-config
data:
  default.conf: |-
      server {
        server_name localhost;
        listen 80 default_server;

        location = /healthz {
          add_header Content-Type text/plain;
          return 200 'ok';
        }

        location / {
            root   /usr/share/nginx/html;
            index  index.html index.htm;
        }

        error_page   500 502 503 504  /50x.html;

        location = /50x.html {
            root   /usr/share/nginx/html;
        }
      }

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL