apiVersion: v1
kind: ConfigMap
metadata:
  name: sample-nginx
data:
  nginx.conf: |-
    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 json_combined escape=json '{ "time_local": "$time_local", '
         '"remote_addr": "$remote_addr", '
         '"remote_user": "$remote_user", '
         '"request": "$request", '
         '"status": "$status", '
         '"body_bytes_sent": "$body_bytes_sent", '
         '"request_time": "$request_time", '
         '"http_referrer": "$http_referer", '
         '"http_user_agent": "$http_user_agent" }';

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

        sendfile        on;
        #tcp_nopush     on;

        keepalive_timeout  65;

        gzip  on;
        server_tokens off;

        server_names_hash_max_size 512;

        include /etc/nginx/conf.d/*.conf;
    }
  default.conf: |-
    server {
        listen 80 default_server;
        listen [::]:80 default_server ipv6only=on;

        server_name localhost;

        root /var/www/html/public;
        index index.php index.html index.htm;
        charset utf-8;

        location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar|svg|mp3)$ {
            try_files $uri =404;
        }

        location / {
             try_files $uri $uri/ /index.php$is_args$args;
        }

        location ~ \.php$ {
            fastcgi_pass php-upstream;
            fastcgi_index index.php;
            fastcgi_buffers 16 16k;
            fastcgi_buffer_size 32k;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include fastcgi_params;
        }
    }
  php-upstream.conf: |-
    upstream php-upstream {
      server localhost:9000;
    }
