How to setup WordPress to publish posts to Fediverse

One of the reasons I’ve set up my WordPress server was because I heard it could be included in as a regular server.

That’s great, right?

All of my posts will appear in the timelines of people who follow me, right?

In theory, yes and yes.

But in reality, it’s not so easy.
How I approached it:

  • Firstly, I set up my own WordPress server on my Proxmox using Turnkey image because it’s easy(ier) than manual WP and database installation (which I failed). I just searched it from Proxmox images and voila, there it is:
  • Installed new LXC, used the image which I just downloaded, ran the container, clicked through initial settings of Turnkey Linux – WordPress. Even I can do this kind of installation. I just had to enter passwords for database, Adminer (database web admin tool), WordPress.
  • I’ve registered a new subdomain (blog.rozman.info), arranged subdomain redirection to my server using DDNS and NGINX reverse proxy, installed certificates for https (won’t go into details about that), the memories of learning this kind of stuff are still too painful 🙂
  • Created a new user (tomi), because ‘admin’ is an ugly name for activitypub handle
  • Installed Activitypub plugin:
  • Created my first post and published it
  • Went to Mastodon and searched for my WordPress user (@tomi@blog.rozman.info)
  • Followed it from my main Mastodon account (@po3mah)
  • I thought I would see the posts under my account, but there were no posts 🙁
  • Searched for my WordPress post on Mastodon using the post URL (thanks Beko Pharm @bekopharm for the tip! Link to a thread)
  • Here it is! It looks like the federation of my WP posts is working! What can I do with it? Boost it for sure!
  • Interesting: if a follower posts a reply to my post in e. g. Mastodon, the comment also appears under my WordPress post!
  • Still, posts weren’t published. I’ve checked apache2 logs and found that mod_evasive module is blocking my reverse proxy server, because it thought it is sending DDoS attack:

[Sat Dec 02 ..... 2023] [evasive20:error] [pid .....] [client 192......] client denied by server configuration: /var/www/wordpress/wp-json
  • So I whitelisted my reverse proxy in /etc/apache2/mods_enabled/evasive.conf
<IfModule mod_evasive20.c>
    DOSHashTableSize    3097
    DOSPageCount        2
    DOSSiteCount        50
    DOSPageInterval     1
    DOSSiteInterval     1
    DOSBlockingPeriod   10

    #DOSEmailNotify      you@yourdomain.com
    #DOSSystemCommand    "su - someuser -c '/sbin/... %s ...'"
    DOSLogDir           "/var/log/mod_evasive"
    DOSWhitelist MY_REVERSE_PROXY_IP
</IfModule>
  • (replace MY_REVERSE_PROXY_IP with real IP)
  • Now WP_CRON (WP plugin) shows activitypub jobs:
  • I thought after that fix my posts would be shown to fediverse followers, but no. I still don’t see new posts if I visit my WP account from Mastodon (until I search for them via URL). Are my expectations wrong or is there a technical issue?
  • Posts still didn’t federate automatically. The author of the plugin pointed me to the certificate issue. I’ve checked my reverse proxy and there was a problem. I forgot to include Let’s Encrypt certificates in my new subdomain configuration file. After correcting that, posts started to appear in my Mastodon timeline. A success!
  • I’ve also installed ‘Friends’ WordPress plugin. I still don’t know what to do with it. Will write about it in the next post.

Overall, enabling WP as an ActivityPub server is very promising and I like it. Nevertheless, it is not so easy to set it up (from the viewpoint of self-hosting). Also, it lacks some functionalities like synchronisation of interaction (likes, …). Can’t wait for the further development of the Fediverse!


Posted

in

by

Comments

Leave a Reply

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