Robocat logo/icon by Stable Diffusion v1.5

How to configure WordPress ActivityPub plugin to work with Nginx and .well-known

When started epub.social as mentioned in “Hello federated world!” post there, ActivityPub, WebFinger were first things I wanted to implement.

There were already WordPress plugins for that. But since my /.well-known/ directory on server was blocked by default , just like all other dot files and directories.

Because of that request block, it took me more than 5 minutes to figure it out – as all tutorials on internet said – “it should wok by default”. After trial and error I found correct settings in NGINX for ActivityPub and WebFinger for .well-known.

The code

I just had to open all directories, that ActivityPub and WebFinger are resolving via WordPress REST API. Here are magic settings for NGINX inside server{} block.

location ~ ^/.well-known/(webfinger|nodeinfo|x-nodeinfo2|host-meta) {
try_files $uri $uri/ /index.php?$args;
}

Simple. For now there are just 4 directories in /.well-known:

  • webfinger (/.well-known/webfinger)
  • nodeinfo (/.well-known/nodeinfo)
  • x-nodeinfo2 (/.well-known/x-nodeinfo2)
  • host-meta (/.well-known/host-meta)

Hope this helps someone else and save siome time!

Same settings are also applied to this blog, so You can follow any author from this blog (and epub.social) on fediverse.

To find out more about WordPress and federated web, You can read posts under “making of epub.social“.


Posted

in

by

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.