Hello Stackers!
Do you want to maintain full control over your NIP-05 identity and use your own domain? If so, setting up a self-hosted NIP-05 ID on Nostr is pretty easy. I'll walk you through the simple steps to set up a self-hosted NIP-05 ID on Nostr using your own domain and hosting.
Before we get started, make sure you have your own domain and hosting. If you don't have one, you can purchase them from any hosting provider of your choice. Also, make sure you have your Nostr Pubkey in hexadecimal format. You can convert it using a tool like https://astral.ninja/devTools
Step 1: The first step is to enter your hosting or web server using Filezilla, an FTP client that allows you to transfer files from your computer to your hosting server. Once you're logged in, navigate to the public_html folder and create a new folder called ".well-known."
Step 2: Now that you have created the ".well-known" folder, you need to create a file called "nostr.json" inside it. Open a text editor on your computer and paste the following code:
{
"names": {
"YOUR_NAME": "YOUR_PUBKEY_IN_HEX_FORMAT"
},
"relays": {
"YOUR_PUBKEY_IN_HEX_FORMAT": [
"wss://nostr.eden.land",
"wss://nostr.relay.damus.io",
"wss://relay.snort.social",
"wss://relay.orangepill.dev"
]
}
}
Replace "YOUR_NAME" with any name you want, and "YOUR_PUBKEY_IN_HEX_FORMAT" with your Nostr Pubkey in Hex format. You can find your pubkey in your Nostr account settings. The relay section is optional, but it allows clients to know which relays they are likely to find you on. Therefore, customize it with the relays added to your account.
Step 3: Now, create a new file in the public_html folder and name it ".htaccess". Open the file and paste the following code:
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>
This code allows your NIP-05 ID to be accessible by any domain.
Step 4: Finally, go to your Nostr client and fulfill the NIP-05 ID with your name you previously added in the nostr.json file + your domain. For example, if your name is "example" and your domain is "domain.com," your NIP-05 ID would be "example@domain.com".
Congratulations, you've successfully set up a self-hosted NIP-05 ID on Nostr using your own domain and hosting! Enjoy the privacy and control that comes with having your own identity system.