Create custom endpoint Initia Node

Prepare :

Change Nameserver

  • Go to account Cloudflare

Searching your domain

  • Choose Free Package

  • Cick Continue

  • and copy nameserver from Cloudflare

  • Edit nameserver on Hostinger or Google domains

  • Paste and change nameserver

  • Go to Cloudflare and click continue step

  • and wait until register nameserver finish, you can received email if finish

Configuration DNS

Seting on VPS

sudo apt autoremove nodejs -y
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/yarnkey.gpg >/dev/null
echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt update
sudo apt install nginx certbot python3-certbot-nginx nodejs git yarn -y 

Prepare set Custom API and RPC

nano .initiad/config/app.toml
  • on API Configuration change false to enable

  • and save on your notepad API local 0.0.0.0:1417

nano .initiad/config/config.toml
  • and save on your notepad RPC local 127.0.0.0:14657

SET VARIABLE

API_DOMAIN=YOUR_API_DOMAIN
RPC_DOMAIN=YOUR_RPC_DOMAIN
API_IP_PORT=IP:PORT
RPC_IP_PORT=RPC:PORT

and paste to your vps

CREATE CONFIG

Config For API

sudo cat <<EOF > /etc/nginx/sites-enabled/${API_DOMAIN}.conf
server {
    server_name $API_DOMAIN;
    listen 80;
    location / {
        add_header Access-Control-Allow-Origin *;
        add_header Access-Control-Max-Age 3600;
        add_header Access-Control-Expose-Headers Content-Length;

	proxy_set_header   X-Real-IP        \$remote_addr;
        proxy_set_header   X-Forwarded-For  \$proxy_add_x_forwarded_for;
        proxy_set_header   Host             \$host;

        proxy_pass http://$API_IP_PORT;

    }
}
EOF

Config For RPC

sudo cat <<EOF > /etc/nginx/sites-enabled/${RPC_DOMAIN}.conf
server {
    server_name $RPC_DOMAIN;
    listen 80;
    location / {
        add_header Access-Control-Allow-Origin *;
        add_header Access-Control-Max-Age 3600;
        add_header Access-Control-Expose-Headers Content-Length;

	proxy_set_header   X-Real-IP        \$remote_addr;
        proxy_set_header   X-Forwarded-For  \$proxy_add_x_forwarded_for;
        proxy_set_header   Host             \$host;
	
	proxy_http_version 1.1;
        proxy_set_header Upgrade \$http_upgrade;
        proxy_set_header Connection "upgrade";

        proxy_pass http://$RPC_IP_PORT;

    }
}
EOF

Config Test

sudo pkill nginx
nginx -t 

Outputt if test ok

Install Certificate SSL

sudo certbot --nginx --register-unsafely-without-email
sudo certbot --nginx --redirect -d ${API_DOMAIN},${RPC_DOMAIN}

And check your RPC and API, if same with screenshot you Finish create custom endpoint

*** For GRPC settings it is the same as above

Last updated