## BEGIN Known Webserver Config (don't remove)

user www-data;

events {
  worker_connections 2048;
  multi_accept       on;
  use                epoll;
}

http {
  sendfile           on;
  tcp_nopush         on;
  tcp_nodelay        on;
  keepalive_timeout  15;

  upstream backend {
    server localhost:9000; #or your php-fpm socket
  }

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

  gzip on;
  gzip_vary on;
  gzip_min_length 10240;
  gzip_proxied expired no-cache no-store private auth;
  gzip_types text/plain text/css text/xml application/javascript application/x-javascript application/xml;
  gzip_disable "MSIE [1-6]\.";

  server {
    listen 80;
    client_max_body_size 20M;
    
    root /var/www/html;
    index index.php;

    open_file_cache          max=2000 inactive=20s;
    open_file_cache_valid    60s;
    open_file_cache_min_uses 5;
    open_file_cache_errors   off;
    
    location ~* \.(css|js|jpg|jpeg|gif|png|ico|xml)$ {
      expires           30d;
      add_header Pragma public;
      add_header Cache-Control "public";
      rewrite ^/css/[0-9]+/(.*) /css/$1 last;
      rewrite ^/js/[0-9]+/(.*) /js/$1 last;
      try_files $uri $uri/ /index.php?$query_string;
    }

    location / {
      try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
      try_files $uri =404;
      fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
      fastcgi_param  SERVER_SOFTWARE    nginx;
      fastcgi_param  QUERY_STRING       $query_string;
      fastcgi_param  REQUEST_METHOD     $request_method;
      fastcgi_param  CONTENT_TYPE       $content_type;
      fastcgi_param  CONTENT_LENGTH     $content_length;
      fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
      fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
      fastcgi_param  REQUEST_URI        $request_uri;
      fastcgi_param  DOCUMENT_URI       $document_uri;
      fastcgi_param  DOCUMENT_ROOT      $document_root;
      fastcgi_param  SERVER_PROTOCOL    $server_protocol;
      fastcgi_param  REMOTE_ADDR        $remote_addr;
      fastcgi_param  REMOTE_PORT        $remote_port;
      fastcgi_param  SERVER_ADDR        $server_addr;
      fastcgi_param  SERVER_PORT        $server_port;
      fastcgi_param  SERVER_NAME        $http_host;
      fastcgi_split_path_info ^(.+\.php)(/.+)$;
      fastcgi_index index.php;
      fastcgi_param PHP_VALUE "cgi.fix_pathinfo=0 \n upload_max_filesize=1000M \n post_max_size=1080M";
      fastcgi_intercept_errors on;
      fastcgi_pass backend;
    }
   
    location ~ /\.ht {
      deny all;
    }

    location ~* \.(xml|ini|json|lock|bak)$ {
      deny all;
    }

    location /configuration/ {
      deny all;
    }

    location /\.git(|hub)/ {
      deny all;
    }
  }
}

## END Known Webserver Config (don't remove)
