dlundgren/phagrancy

View on GitHub
docker/nginx/nginx.conf

Summary

Maintainability
Test Coverage
daemon off;
worker_processes 2;

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"';

    sendfile        on;
    tcp_nopush      on;
    tcp_nodelay     on;
    server_tokens   off;
    keepalive_timeout  65;
    gzip  on;

    server {
      listen         80;
      server_name    phagrancy.local;
      return         301 https://$server_name$request_uri;
    }

    server {
      listen 443 ssl http2;
      server_name phagrancy.local;
      ssl_certificate /etc/nginx/certs/phagrancy.local.crt;
      ssl_certificate_key /etc/nginx/certs/phagrancy.local.key;
      ssl_protocols TLSv1.1 TLSv1.2;
      ssl_ciphers HIGH:!aNULL:!MD5;
      ssl_prefer_server_ciphers on;
      ssl_session_cache   shared:SSL:20m;
      ssl_session_timeout 10m;

      root /srv/phagrancy/web;
      index index.php index.html;
      error_log /dev/stdout;
      access_log /dev/stdout main;
      client_max_body_size 7000m;

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

      location ~ [^/]\.php(/|$) {
          fastcgi_split_path_info ^(.+?\.php)(/.*)$;
          if (!-f $document_root$fastcgi_script_name) {
                  return 404;
          }

          fastcgi_pass phagrancy-php-fpm:9000;
          include fastcgi_params;
          fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      }
    }
}