Ipns publish issue

hi,all
I follow the tutorial “https://ipfs.io/docs/examples/example-viewer/example#../websites/README.md
Q1:I “ipfs add -r” a website, but it can’t open in http://gateway.ipfs.io/ipfs/$SITE_HASH

Q2: I “ipfs publish name” it,and it seems unsuccessful?

Let’s first solve Q1. So let’s say you have the following directory:

my-directory/
   index.html
   another-file.txt

If you do ipfs add -r my-directory from outside the directory, you should see output that looks like this:

added QmU2viJUREiEcFPgx5rzEVtB8psw1F49hYc5C7pS6pffpt my-directory/another-file.txt
added QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o my-directory/index.html
added Qma2taWsdSfFHEWGZtN6XPdfNXCGdcGDoBgXERz4v1n9C9 my-directory

If you take the last hash, Qma2taWsdSfFHEWGZtN6XPdfNXCGdcGDoBgXERz4v1n9C9 and load from your local node (by going to http://localhost:8080/ipfs/Qma2taWsdSfFHEWGZtN6XPdfNXCGdcGDoBgXERz4v1n9C9), you should see the contents of the index.html file.

If that is working, but replacing localhost:8080 with ipfs.io doesn’t load the index.html file, you’re having some troubles with getting the public gateways to reach you. Make sure no firewalls are blocking port 4001 and it should be working.

If you can’t load locally added files from the gateway, something with your connection is not allowing IPFS to work properly and IPNS is probably not gonna work very well then either.

2 Likes

thanks for ur detailed reply, and now I made it

As for DNS TXT record and A record I think it is none of ipfs’s business and it is only regarded for network layer