apiVersion: v1
kind: ConfigMap
metadata:
  name: nginx-config
data:
  nginx-config: |+
    user  nginx;
    worker_processes  1;

    error_log  /var/log/nginx/error.log warn;
    pid        /var/run/nginx.pid;


    events {
        worker_connections  1024;
    }


    http {
        include       /etc/nginx/mime.types;
        default_type  application/octet-stream;

        log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                          '$status $body_bytes_sent "$http_referer" '
                          '"$http_user_agent" "$http_x_forwarded_for"';

        access_log  /var/log/nginx/access.log  main;

        sendfile        on;
        #tcp_nopush     on;

        keepalive_timeout  65;

        gzip  on;
        gzip_disable "msie6"; #IE6不使用gzip
        gzip_vary on; #设置为on会在Header里增加 "Vary: Accept-Encoding"
        gzip_proxied any; #代理结果数据的压缩
        gzip_comp_level 6; #gzip压缩比（1~9），越小压缩效果越差，但是越大处理越慢，所以一般取中间值
        gzip_buffers 16 8k; #获取多少内存用于缓存压缩结果
        gzip_http_version 1.1; #识别http协议的版本
        gzip_min_length 1k; #设置允许压缩的页面最小字节数，超过1k的文件会被压缩
        gzip_types application/javascript text/css; #对特定的MIME类型生效,js和css文件会被压缩
        client_max_body_size     50m;
        client_header_timeout    1m;
        client_body_timeout      1m;
        proxy_connect_timeout     60s;
        proxy_read_timeout      1m;
        proxy_send_timeout      1m;

        server {
                listen       80;
                server_name  localhost;

                root   /usr/share/nginx/html;
                index  index.php index.html index.htm;
                location / {
                    try_files $uri $uri/ = 404;
                }

                error_page   500 502 503 504  /50x.html;
                location = /50x.html {
                    root   /usr/share/nginx/html;
                }

                location ~ \.php$ {
                           try_files $uri =404;
                           fastcgi_pass   10.100.6.140:9001;
                           fastcgi_index  index.php;
                           fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
                           include        fastcgi_params;
                }
            }
    }

