<commit_before>##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##

# Default server configuration
#
server {
  listen 80 default_server;
  listen [::]:80 default_server ipv6only=on;

  server_name <%= fetch(:server) %>;
  passenger_enabled on;
  rails_env <%= fetch(:stage) %>;
  root <%= fetch(:deploy_to) %>/current/public;

<% if fetch(:stage) == :production %>
  # SSL configuration
  #
  # listen 443 ssl default_server;
  # listen [::]:443 ssl default_server;
  #
  # ssl_certificate /etc/ssl/certs/$server_name.chained.crt;
  # ssl_certificate_key /etc/ssl/private/$server_name.key;
  #
  # Self signed certs generated by the ssl-cert package
  # Don't use them in a production server!
  #
  # include snippets/snakeoil.conf;
<% end %>

  client_max_body_size <%= fetch(:nginx_max_body_size) %>;

  error_page 404 /404.html;
  error_page 422 /422.html;
  error_page 500 502 503 504 /500.html;

<% fetch(:nginx_assets_dirs).each do |dir| %>
  location /<%= dir %>/ {
    gzip_static on;
    expires 1M;
    add_header Cache-Control public;
    add_header Last-Modified "";
    add_header ETag "";
    break;
  }
<% end %>
}

server {
  listen 80;

  server_name www.<%= fetch(:server) %>;
  return 301 $scheme://$server_name$request_uri;
}

<% if fetch(:stage) == :production %>
#server {
#  listen 443;
#
#  server_name www.<%= fetch(:server) %>;
#  return 301 $scheme://$server_name$request_uri;
#}
<% end %>
# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
#server {
#  listen 80;<commit_msg>nginx template improved for www rewrite<commit_after>##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##

# Default server configuration
#
server {
  listen 80 default_server;
  listen [::]:80 default_server ipv6only=on;

  server_name <%= fetch(:server) %>;
  passenger_enabled on;
  rails_env <%= fetch(:stage) %>;
  root <%= fetch(:deploy_to) %>/current/public;

<% if fetch(:stage) == :production %>
  # SSL configuration
  #
  # listen 443 ssl default_server;
  # listen [::]:443 ssl default_server;
  #
  # ssl_certificate /etc/ssl/certs/$server_name.chained.crt;
  # ssl_certificate_key /etc/ssl/private/$server_name.key;
  #
  # Self signed certs generated by the ssl-cert package
  # Don't use them in a production server!
  #
  # include snippets/snakeoil.conf;
<% end %>

  client_max_body_size <%= fetch(:nginx_max_body_size) %>;

  error_page 404 /404.html;
  error_page 422 /422.html;
  error_page 500 502 503 504 /500.html;

  if ($host = www.$server_name) {
    return 301 $scheme://$server_name$request_uri;
  }

<% fetch(:nginx_assets_dirs).each do |dir| %>
  location /<%= dir %>/ {
    gzip_static on;
    expires 1M;
    add_header Cache-Control public;
    add_header Last-Modified "";
    add_header ETag "";
    break;
  }
<% end %>
}

# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
#server {
#  listen 80;
{'fraction_non_alphanumeric': 0.12670025188916875, 'fraction_numerical': 0.024181360201511334, 'mean_word_length': 3.8133333333333335, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6443789', 'n_tokens_mistral': 1449, 'n_tokens_neox': 1296, 'n_words': 386}