NIP05 for self hosted ghost

NIP05 for self hosted ghost

Verify your Nostr identity using your self hosted ghost website

Verify your Nostr identity using your self hosted ghost website

This guide is for people already running self hosted ghost. If you don't have a self hosted ghost website read this guide.

Add the nostr.json file to /.well-known/

SSH into your ghost VPS and enter your www folder

cd /var/www/

List the contents to see the name of your ghost folder, for me it is simply ghost. Enter that folder / system / nginx-root.

/var/www/ghost/system/nginx-root
This is the filepath for me, you may have used a different name to 'ghost'

Make a folder here called .well-known (the . is important)

mkdir .well-known

Enter that folder

cd .well-known

Make the nostr.json file

touch nostr.json
nano nostr.json

Paste the below text but replace your-npub-in-hex-format with your npub. You can get the hex version of your npub using the online damus key converter.

{
  "names": {
    "_": "your-npub-in-hex-format"
  }
}

Save and exit (ctrl-x, y)

Changing NGINX configuration

Enter the nginx directory

cd /etc/nginx/sites-available

There will be two files, the domain.conf and domain-ssl.conf

I don't know what is required but become superuser ( sudo su ) and edit both with nano to include an instruction to add headers to the request.

    location ~ /.well-known {
        allow all;
    }
Before Edit
    location ~ /.well-known {
        allow all;
	add_header Access-Control-Allow-Origin *; 
    }
After Edit

Restart nginx

systemctl restart nginx

Add your NIP05 to your nostr profile

Open your nostr app and use _@domain.com (for me, _@orange.surf)

If everything is success you should see your domain.com (orange.surf) below your name.

If not you can check if the header has been added

curl -I https://domain/.well-known/nostr.json

for me 
curl -I https://orange.surf/.well-known/nostr.json

The result should contain

access-control-allow-origin: *

If you get a 404 error you may have put the nostr.json file in the wrong place.


Thank you for reading. If you enjoyed this post please share it.  
🌊
If you got value from this guide consider sending some sats