Domain registry project http://reg.i2p/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

2.6 KiB

Registry - reg.i2p

This is reg.i2p domain registry code

Requirements

  • i2pd with enabled BOB protocol
  • verifyhost binary built inside i2pd-tools project folder
  • PHP and php-fpm 7.2+
  • Composer
  • Corntab (for jobs)

Installation

  1. Clone repository in your webserver working directory. Note: that must not be /var/www/html or something like this, your webserver must point to public directory of forked project.
  2. Fetch requirements by runnning composer update.
  3. Point your webserver to serving webpages from public directory.
  4. Create cron jobs for quering and updating hosts lists.

nginx configuration

server {
    listen       127.0.0.1:8000;

    access_log   /dev/null;
    error_log    /dev/null;

    root         /home/www/reg.i2p/public;
    index        index.php index.html;
    port_in_redirect off;

    location ~* ^/hosts\.txt$ {
        if ($http_if_none_match) {
            rewrite ^/hosts\.txt$ /export/hosts.txt break;
        }

        rewrite ^/hosts\.txt$ /export/hosts-basic.txt break;
    }

    location / {
        try_files $uri $uri/ /index.php$request_uri;
    }

    location ~ ^/index\.php(/|$) {
        include       fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param SERVER_PORT     80;
        fastcgi_pass  unix:/home/www/reg.i2p/tmp/php-fpm.sock;
    }
}

php-fpm configuration

[reg.i2p]

prefix = /home/www/$pool
user = www-data
group = www-data
listen = tmp/php-fpm.sock

listen.owner = www-data
listen.group = www-data
listen.mode = 0660

pm = dynamic
pm.max_children = 5
pm.start_servers = 1
pm.min_spare_servers = 1
pm.max_spare_servers = 2
pm.max_requests = 500

chdir = public

php_admin_flag[log_errors] = On
php_admin_flag[display_errors] = Off
php_admin_value[error_reporting] = E_ALL
php_admin_value[error_log] = /home/www/$pool/logs/php-error.log

php_admin_value[upload_tmp_dir] = /home/www/$pool/tmp
php_admin_value[date.timezone] = Etc/UTC

php_admin_value[session.save_path] = /home/www/$pool/sessions
php_admin_value[session.save_handler] = files
php_admin_value[session.gc_probability] = 2
php_admin_value[session.gc_maxlifetime] = 1440

php_admin_value[memory_limit] = 32M
php_admin_value[upload_max_filesize] = "2M"
php_admin_value[max_execution_time] = 60

Cron jobs

5 * * * *    php7.2 /home/www/reg.i2p/checker.php > /home/www/reg.i2p/logs/checker.log 2>&1
45 */6 * * * php7.2 /home/www/reg.i2p/export.php  > /home/www/reg.i2p/logs/export.log  2>&1
50 23 * * *  php7.2 /home/www/reg.i2p/fetch.php   > /home/www/reg.i2p/logs/fetch.log   2>&1