<commit_before>upstream puma_<%= fetch(:application) %> {
  server unix://<%= shared_path %>/tmp/sockets/<%= fetch(:application) %>-puma.sock;
}

<%- if ssl? -%>
server {
  listen 80 <%= default_server %>;
  listen [::]:80 <%= default_server %>;
  server_name <%= server_name %>;
  return 301 "<%= return_url %>";
}
<%- end -%>

server {
  <%- if ssl? -%>
  listen 443 <%= default_server %> ssl;
  listen [::]:443 <%= default_server %> ssl;

  ssl on;
  ssl_certificate /etc/nginx/ssl/certificate.pem;
  ssl_certificate_key /etc/nginx/ssl/key.pem;

  ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  ssl_prefer_server_ciphers on;
  ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
  <%- else -%>
  listen 80 <%= default_server %>;
  listen [::]:80 <%= default_server %>;
  <%- end -%>

  server_name <%= server_name %>;
  root <%= fetch(:deploy_to) %>/current/public;

  location ^~ /assets/ {
    gzip_static on;
    expires max;
    add_header Cache-Control public;
  }

  try_files $uri/index.html $uri @puma_<%= fetch(:application) %>;
  location @puma_<%= fetch(:application) %> {
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_redirect off;
    proxy_pass http://puma_<%= fetch(:application) %>;
    <%- if ssl? -%>
    proxy_set_header X-Forwarded-Proto https;
    <%- end -%>
  }

  error_page 500 502 504 /500.html;
  client_max_body_size 4G;
  keepalive_timeout 10;

  error_page 503 @503;
  # Return a 503 error if the maintenance page exists.
  if (-f <%= fetch(:deploy_to) %>/shared/public/system/maintenance.html) {
    return 503;
  }

  location @503 {
    # Serve static assets if found.
    if (-f $request_filename) {
      break;
    }

    # Set root to the shared directory.
    root <%= fetch(:deploy_to) %>/shared/public;
    rewrite ^(.*)$ /system/maintenance.html break;<commit_msg>update nginx conf to be compatible with rails#send_file<commit_after>upstream puma_<%= fetch(:application) %> {
  server unix://<%= shared_path %>/tmp/sockets/<%= fetch(:application) %>-puma.sock;
}

<%- if ssl? -%>
server {
  listen 80 <%= default_server %>;
  listen [::]:80 <%= default_server %>;
  server_name <%= server_name %>;
  return 301 "<%= return_url %>";
}
<%- end -%>

server {
  <%- if ssl? -%>
  listen 443 <%= default_server %> ssl;
  listen [::]:443 <%= default_server %> ssl;

  ssl on;
  ssl_certificate /etc/nginx/ssl/certificate.pem;
  ssl_certificate_key /etc/nginx/ssl/key.pem;

  ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  ssl_prefer_server_ciphers on;
  ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
  <%- else -%>
  listen 80 <%= default_server %>;
  listen [::]:80 <%= default_server %>;
  <%- end -%>

  server_name <%= server_name %>;
  root <%= fetch(:deploy_to) %>/current/public;

  location ^~ /assets/ {
    gzip_static on;
    expires max;
    add_header Cache-Control public;
  }

  location /_downloads {
    internal;
    alias <%= fetch(:deploy_to) %>/releases;
  }

  try_files $uri/index.html $uri @puma_<%= fetch(:application) %>;
  location @puma_<%= fetch(:application) %> {
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_redirect off;
    proxy_pass http://puma_<%= fetch(:application) %>;

    proxy_set_header X-Sendfile-Type X-Accel-Redirect;
    proxy_set_header X-Accel-Mapping <%= fetch(:deploy_to) %>/releases/=/_downloads/;

    <%- if ssl? -%>
    proxy_set_header X-Forwarded-Proto https;
    <%- end -%>
  }

  error_page 500 502 504 /500.html;
  client_max_body_size 4G;
  keepalive_timeout 10;

  error_page 503 @503;
  # Return a 503 error if the maintenance page exists.
  if (-f <%= fetch(:deploy_to) %>/shared/public/system/maintenance.html) {
    return 503;
  }

  location @503 {
    # Serve static assets if found.
    if (-f $request_filename) {
      break;
    }

    # Set root to the shared directory.
    root <%= fetch(:deploy_to) %>/shared/public;
    rewrite ^(.*)$ /system/maintenance.html break;
{'fraction_non_alphanumeric': 0.16327543424317617, 'fraction_numerical': 0.028784119106699754, 'mean_word_length': 3.4988839285714284, 'pattern_counts': {'":': 0, '<': 55, '<?xml version=': 0, '>': 55, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5654935', 'n_tokens_mistral': 1707, 'n_tokens_neox': 1462, 'n_words': 311}