<commit_before># DO NOT EDIT - This file is being maintained by Chef

<% [80, 443].each do |port| -%>
<VirtualHost *:<%= port %>>
    ServerName <%= node[:fqdn] %>
    ServerAlias nominatim.openstreetmap.org
    ServerAlias nominatim.osm.org
    ServerAlias nominatim.openstreetmap.org
    ServerAlias nominatim.openstreetmap.net
    ServerAlias nominatim.openstreetmaps.org
    ServerAlias nominatim.openmaps.org
    ServerAdmin <EMAIL>

<% if port == 443 -%>
    #
    # Enable SSL
    #
    SSLEngine on
<% end -%>

    CustomLog /var/log/apache2/nominatim.openstreetmap.org-access.log combined
    ErrorLog /var/log/apache2/nominatim.openstreetmap.org-error.log

    DocumentRoot <%= @directory %>/website
    <Directory "<%= @directory %>/website/">
        DirectoryIndex search.php
        Options MultiViews FollowSymLinks
        AddType text/html   .php
        AddType application/xml   .phpx
        AddType application/json   .phpj
<% if node[:lsb][:release].to_f >= 14.04 -%>
        Require all granted
<% end -%>
    </Directory>

    <Location />
<% if node[:lsb][:release].to_f >= 14.04 -%>
        ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:<%= @pools[:www][:port ]%>/
        ProxyPassMatch ^/(.*\.phpx(/.*)?)$ fcgi://127.0.0.1:<%= @pools[:www][:port ]%>/
        ProxyPassMatch ^/(.*\.phpj(/.*)?)$ fcgi://127.0.0.1:<%= @pools[:www][:port ]%>/
<% else -%>
        AddHandler fcgi:/var/run/php5-fpm-www.sock .php
        AddHandler fcgi:/var/run/php5-fpm-www.sock .phpx
        AddHandler fcgi:/var/run/php5-fpm-www.sock .phpj
<% end -%>
    </Location>

    <% @pools.each do |name,details| -%>
    Alias /pool-<%= name %>/ "<%= @directory %>/website/"
    <Location /pool-<%= name %>>
<% if node[:lsb][:release].to_f >= 14.04 -%>
        ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:<%= details[:port ]%>/
        ProxyPassMatch ^/(.*\.phpx(/.*)?)$ fcgi://127.0.0.1:<%= details[:port ]%>/
        ProxyPassMatch ^/(.*\.phpj(/.*)?)$ fcgi://127.0.0.1:<%= details[:port ]%>/
<% else -%>
        AddHandler fcgi:/var/run/php5-fpm-<%= name %>.sock .php
        AddHandler fcgi:/var/run/php5-fpm-<%= name %>.sock .phpx
        AddHandler fcgi:/var/run/php5-fpm-<%= name %>.sock .phpj
<% end -%>
    </Location>
    <% end -%>

    Redirect 420 /pool-block/
    ErrorDocument 420 /509.html
    <Location /pool-block>
        ErrorDocument 420 /509.html
    </Location>
    Redirect 403 /pool-ban/
    <Location /pool-ban>
        ErrorDocument 403 /403.html
    </Location>
    ErrorDocument 403 /403.html

    RewriteEngine On

    # manual blocks
    Include <%= @directory %>/settings/apache_blocks.conf

    # regular requests and autoblocks
    RewriteMap bulklist txt:<%= @directory %>/settings/ip_blocks.map
    RewriteRule ^/([sdr].*) /pool-${bulklist:%{REMOTE_ADDR}|www}/$1 [PT]

</VirtualHost>

<% end -%>
<commit_msg>Workaround horrendous ProxyPassMatch silliness<commit_after># DO NOT EDIT - This file is being maintained by Chef

<% [80, 443].each do |port| -%>
<VirtualHost *:<%= port %>>
    ServerName <%= node[:fqdn] %>
    ServerAlias nominatim.<EMAIL>
    ServerAlias nominatim.osm.org
    ServerAlias nominatim.openstreetmap.org
    ServerAlias nominatim.openstreetmap.net
    ServerAlias nominatim.openstreetmaps.org
    ServerAlias nominatim.openmaps.org
    ServerAdmin <EMAIL>

<% if port == 443 -%>
    #
    # Enable SSL
    #
    SSLEngine on
<% end -%>

    CustomLog /var/log/apache2/nominatim.openstreetmap.org-access.log combined
    ErrorLog /var/log/apache2/nominatim.openstreetmap.org-error.log

    DocumentRoot <%= @directory %>/website
    <Directory "<%= @directory %>/website/">
        DirectoryIndex search.php
        Options MultiViews FollowSymLinks
        AddType text/html   .php
        AddType application/xml   .phpx
        AddType application/json   .phpj
<% if node[:lsb][:release].to_f >= 14.04 -%>
        Require all granted
<% end -%>
    </Directory>

    <LocationMatch /.*\.php[xj]?(/.*)?$>
<% if node[:lsb][:release].to_f >= 14.04 -%>
        ProxyPassMatch fcgi://127.0.0.1:<%= @pools[:www][:port ]%>/
<% else -%>
        SetHandler fcgi:/var/run/php5-fpm-www.sock
<% end -%>
    </LocationMatch>

    <% @pools.each do |name,details| -%>
    Alias /pool-<%= name %>/ "<%= @directory %>/website/"
    <LocationMatch /pool-<%= name %>/.*\.php[xj]?(/.*)?$>
<% if node[:lsb][:release].to_f >= 14.04 -%>
        ProxyPassMatch fcgi://127.0.0.1:<%= details[:port ]%>/
<% else -%>
        SetHandler fcgi:/var/run/php5-fpm-<%= name %>.sock
<% end -%>
    </LocationMatch>
    <% end -%>

    Redirect 420 /pool-block/
    ErrorDocument 420 /509.html
    <Location /pool-block>
        ErrorDocument 420 /509.html
    </Location>
    Redirect 403 /pool-ban/
    <Location /pool-ban>
        ErrorDocument 403 /403.html
    </Location>
    ErrorDocument 403 /403.html

    RewriteEngine On

    # manual blocks
    Include <%= @directory %>/settings/apache_blocks.conf

    # regular requests and autoblocks
    RewriteMap bulklist txt:<%= @directory %>/settings/ip_blocks.map
    RewriteRule ^/([sdr].*) /pool-${bulklist:%{REMOTE_ADDR}|www}/$1 [PT]

</VirtualHost>

<% end -%>

{'fraction_non_alphanumeric': 0.18604651162790697, 'fraction_numerical': 0.031395348837209305, 'mean_word_length': 2.655099150141643, 'pattern_counts': {'":': 0, '<': 88, '<?xml version=': 0, '>': 94, 'https://': 0, 'lorem ipsum': 0, 'www.': 10, 'xml': 2}, 'pii_count': 8, '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': '1554915', 'n_tokens_mistral': 2087, 'n_tokens_neox': 1814, 'n_words': 355}