How to Set Up Explorer

Install Dependencies

sudo apt autoremove nodejs -y
curl -fsSL https://deb.nodesource.com/setup_19.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

NGINX Configuration

Create an NGINX configuration file for your explorer:

Replace explorer.dongqn.com with your site's name, for example:

Create this sample configuration:

Remember to replace server_name with your server's name.

SSL Configuration

Install Certificate SSL

Select option 2 and press Enter. If the BOT asks for redirection, choose YES.

After completion, you can restart NGINX:

Explorer Configuration

Clone the Repository

Build the Explorer

Navigate to the explorer directory, install dependencies, and build:

If you encounter any issues, use the following command:

Copy the Web Files to the Nginx HTML Folder


RPC and API Setup Guide

Installing Dependencies and Setting Up Nginx

Connect to your Node and execute the following commands to install Nginx:

API Nginx Configuration File Creation

Create a configuration file for your API:

Inside the file, it's time to enter the necessary configuration for your API subdomain. Below is a template designed specifically for a Node.js application. Make sure you understand each directive and modify it to fit the specific needs of your application, especially the proxy_pass directive, which should point to the port your application is running on:

Replace api-testnet-nillion.dongqn.com with your domain in the server_name section, and adjust the port number in the proxy_pass directive if necessary (default is 1317). This setup instructs the server to listen on port 80, the default for HTTP. The server_name should match your project's subdomain. The proxy_pass directive is crucial as it tells NGINX where to route requests entering this subdomain.

Creating Your RPC Nginx Configuration File

Similarly, create a configuration for your RPC:

Enter the configuration, replacing api-testnet-nillion.dongqn.com with your domain and adjusting the proxy_pass for your RPC port (default is 26657).

Activating Your Configuration

After tailoring the configuration file to your needs and saving your changes, the next step is to link this file to the sites-enabled directory to activate it:

This command creates a symbolic link between the sites-available and sites-enabled directories, effectively activating your configuration.

Finally, test your NGINX configuration for syntax errors:

If the test passes without issues, reload NGINX to apply the changes:

Your subdomains should now be set up and accessible via the specified subdomain addresses. This setup enhances the structure of your project by creating a clear distinction between different parts of your application, facilitating developers and users to interact with your endpoints.

However, all your endpoints are still using unsecure HTTP. In the next section, we'll install SSL for all our endpoints.

SSL Configuration

Last updated