HTML snippet

<!-- Index Counter v17.12.1 -->
<script>
  (function (n, w, d, l, t, c) {
    c = w[n] = w[n] || {};
    c.js = ["//c.index.ru/tnc.js", "/tnc.js"];
    (function load(i, s, e) {
      s = d.createElement(t); s.async = true; s.type = "text/javascript";
      s.src = c.js[i] + "?h=" + encodeURIComponent(l.hostname);
      s.onerror = function () { if (i + 1 < c.js.length) { load(i + 1); } };
      e = d.getElementsByTagName(t)[0]; e.parentNode.insertBefore(s, e);
    })(0);
  })("index.ru", window, document, location, "script");
</script>
<!-- /Index Counter -->

Local proxy nginx configuration (optional)

nginx.conf:
...

upstream index {
    server c.index.ru:443;
    keepalive 4;
}

server {
...
    # Index Counter v18.05.1 https://index.ru/install/
    location = /tnc {
        proxy_cookie_domain index.ru $http_host;
        proxy_http_version 1.1;
        proxy_pass https://index;
        proxy_set_header Connection "";
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Real-IP $remote_addr;
    }

    location = /tnc.js {
        proxy_cookie_domain index.ru $http_host;
        proxy_http_version 1.1;
        proxy_pass https://index;
        proxy_set_header Connection "";
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Real-IP $remote_addr;
    }
    # end of Index Counter
...
}

Local proxy Apache configuration (optional, not recommended)

httpd.conf:
...
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule ssl_module modules/mod_ssl.so
...

<VirtualHost ...>
    ...
    # Index Counter v18.11.1 https://index.ru/install/
    SSLProxyEngine on

    ProxyPass /tnc https://c.index.ru/tnc
    ProxyPass /tnc.js https://c.index.ru/tnc.js
    ProxyPassReverseCookieDomain .index.ru REPLACE_WITH_SERVER_NAME
    # end of Index Counter
    ...
</VirtualHost>

Local proxy PHP + Apache configuration (optional, not recommended)

Note: using this mode slows down your server. You should only use it when you don't have access to the main server configuration file.

This mode requires enabled the following features in your Apache HTTP server:

Place file tnc.php under the document root of the server.

Add the following rules to .htaccess:
# Index Counter v18.12.1 https://index.ru/install/
RewriteRule tnc$ /tnc.php [L]
RewriteRule tnc.js$ /tnc.php [L]
# end of Index Counter