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.

114 lines
2.9 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. It must be placed in `bin` directory
* PHP and php-fpm 7.2+
* php-intl package on PHP 7.4+ (php7.4-intl as example on Debian with PHP 7.4)
* 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. Copy `config.php.dist` to `config.php` and conigure project for your needs
4. Point your webserver to serving webpages from `public` directory.
5. Create cron jobs for quering and updating hosts lists.
Configuration examples below are using `/home/www/reg.i2p` as website homedir. Note that files inside that directory must be owned by php user (usually it is `www-data`):
nginx configuration
---
```nginx
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
---
```conf
[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
---
```crontab
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
```