Welcome to the Elastos Blog
Read it here first
Guide to Hosting Your Personal Website with the Active Proxy Service
Elastos emerges as a beacon of hope in the Web3 world where online privacy and data ownership have become increasingly important. This platform offers individuals complete control over their digital assets. Active Proxy service, the revolutionary feature on Elastos Carrier, allows users to host their own personal website from their local device, and ensures the website is accessible to the entire internet while users retain absolute ownership and control of their data.
Setting up a personal website via the Active Proxy service not only grants you full data control but also ensures privacy and reliability. It allows for secure global access, reduced latency, and tamper-proof content thanks to the blockchain technology. Moreover, Elastos provides streamlined tasks through the Elastos Smart Contract (ESC) sidechain, simplified digital asset management via the Essentials wallet, trust establishment with Elastos DIDs, decentralized domain names, and Digital Rights Management (DRM) technology for enhanced control and content security, ultimately boosting monetization possibilities.
In this article, we will provide a step-by-step guide on how to set up a personal website via the Active Proxy service.
- A Debian-based Linux distribution.
- A domain name registered on pc2.net.
- Basic command-line knowledge.
Step 1: Update Your System
$ sudo apt-get update
Step 2: Install Required Packages
Install the necessary packages and dependencies:
$ sudo apt-get install -y build-essential autoconf automake autopoint libtool cmake libncurses-dev git
Step 3: Clone Carrier Repository
Navigate to your home folder and clone the Carrier repository:
$ cd ~
Step 4: Create a Build Directory
Change to the build directory inside the Carrier repository and create and name a directory:
$ cd Elastos.Carrier.Native/build
$ mkdir linux && cd linux
Step 5: Generate Makefiles and Compile
Generate the Makefile files with this prompt:
$ cmake -DCMAKE_INSTALL_PREFIX=dist -DCMAKE_BUILD_TYPE=Debug ../..
Then compile the Carrier with all options included using this command:
$ make && make install
Step 6: Move Configuration File
Move the configuration file to the appropriate directory and rename it as “default.conf”:
$ mv ~/Elastos.Carrier.Native/apps/launcher/sample.conf ~/Elastos.Carrier.Native/build/linux/apps/launcher/default.conf
Step 7: Update Configuration File
Edit the configuration file using your favorite text editor, e.g., nano:
$ nano ~/Elastos.Carrier.Native/build/linux/apps/launcher/default.conf
Update the following lines in the config file under the “addons” section:
- peerPrivateKey: Replace with your own peer private key. (Generate the private key as specified in step 13)
- “domainName”: Replace with your registered domain name from pc2.net.
- “upstreamHost”: Set to your local device’s IP address.
- “upstreamPort”: Set to 8989 or the port you plan to use for your website.
Step 8: Launch Carrier
Run the following command to launch the Carrier service:
$ ./carrier-launcher -c default.conf
If you need to restart the launcher, use the following commands:
$ ps -e | grep carrier
$ kill -9 “IDprocess”
Run the command with the suffix “&” to indicate that this command will run in the background.
Once the launcher is running, check the nodeId by using the command:
$ cat ~/Elastos.Carrier.Native/build/linux/apps/launcher/data/id && echo
Use this base58 Node ID string when you register or update your pc2 domain name.
Step 9: Register a DDNS Domain
Go to pc2.net, need to use Essentials to get signed in with your DID, choose “REGISTER DDNS NAME,” enter your domain name and Node ID, and then click on “REGISTER.”
Step 10: Install Caddy Server
Download the Caddy server binary and move it to the /usr/local/bin/ directory, and make sure this /usr/local/bin is in the $PATH environment :
wget -O caddy https://github.com/caddyserver/caddy/releases/download/v2.7.4/caddy_2.7.4_linux_amd64.tar.gz
tar -xzvf caddy
sudo mv caddy /usr/local/bin/
sudo chmod +x /usr/local/bin/caddy
Here we use Caddy service as an example of a personal web service. Users can replace their own dedicated personal service by deploying on LAN home, while being able to share it outside for the public.
Step 11: Create an example of Web content to set up your website
Create a directory for your website content and download your website files (e.g., AdminLTE) into it. Unzip the files if necessary:
$ mkdir ~/web
$ wget https://github.com/ColorlibHQ/AdminLTE/archive/refs/tags/v3.2.0.tar.gz
$ mv v3.2.0.tar.gz ~/web
$ tar -xzvf ~/web/v3.2.0.tar.gz -C ~/web
Step 12: Run Caddy Server
Start the Caddy server with the following command:
$ caddy file-server –listen 0.0.0.0:8989
Then you can check it on your local environment by inputting an url like: http://YOUR-LOCAL-IP-OF-THE-DEVICE:8989
If another web service is already using the default port 80 on the device, you can use a different port for your web service.
Here the port needs to match the value of item “upstreamPort” in “default.conf”
Step 13: Generate Your Node Private Key
On the Carrier Network, every service is considered an equal peer. Services can be publicly announced within the network, and interested parties can retrieve information about a specific service by using its unique peer ID, which follows the same format as a Node ID. To maintain ownership of a service, the user responsible for it must generate and associate a peer ID, and each service peer must secure its operation by binding it to a private key.
To generate your private key node, follow these steps:
- Clone the Elastos.Carrier.Java repository:
$ git clone https://github.com/elastos/Elastos.Carrier.Java.git
- Compile the Java code:
$ cd Elastos.Carrier.Java
- Enter the shell directory and run the carrier-shell command:
$ cd shell/target/bin/
- In the carrier-shell, run the keygen sub command to generate a private key:
Carrier $ keygen
Once the set of private and public keys are generated, then add “Private Key of Signature to the “default.conf” file for authentication.
After all steps are finished, you can then restart the carrier-launcher so the function works properly.
By hosting your website on Elastos and using Active Proxy, you’ve taken a significant step towards asserting your digital freedom. You now have control over your data and are contributing to a more decentralized and user-centric internet.
With the ability to host content from your local device, accessible globally, you’ve joined a community that values data ownership and privacy. You’re part of the movement towards a more secure and user-driven digital future.Keep exploring, innovating, and advocating for a more secure and open internet where individuals have control over their digital destinies.
This tutorial was meticulously crafted by our esteemed community member, EverlastingOS. We extend our sincere appreciation to EverlastingOS for his invaluable contribution to our community’s knowledge and empowerment.
You’re welcome to show your appreciation for EverlastingOS’s valuable contributions through donations at the following address: EZwpppnS2ML1dNvKvEcQKnziF1oVuPbHNd