Webserver/wordpress

Hi!

I had installed wordpress on a MIAB server and ran into a couple of issues trying to update and sometimes when uploading new media. It turns out the user and group used by php is www-data and not user-data. I initially just changed that in the [www] pool and it appeared fine, but when trying to use roundcube and nextcloud problems arose, ie; they were not at all usable. To fix this:

copy the pool:
sudo cp /etc/php/7.2/fpm/pool.d/www.conf /etc/php/7.2/fpm/pool.d/wordpress.conf

open with your editor, my weapon of choice is nano:
sudo nano /etc/php/7.2/fpm/pool.d/wordpress.conf

edit the new file on line 4:
[wordpress]
and line 23-24:
user = user-data
group = user-data
then line 36:
listen = /run/php/wordpress.sock

In /home/user-data/www/ I assume you already have an nginx conf file for the domain you have wordpress on ie: /home/user-data/www/website.com.conf and the folder /home/user-data/www/website.com exists, so edit your /home/user-data/www/website.com.conf file to include the following:

index index.php;

location ~* \.php$ {
    fastcgi_pass unix:/run/php/wordpress.sock;
    include         fastcgi_params;
    fastcgi_param   SCRIPT_FILENAME    $document_root$fastcgi_script_name;
    fastcgi_param   SCRIPT_NAME        $fastcgi_script_name;
}

Update MIAB’s config (not sure how necessary this is):
cd /root/mailinabox/tools; sudo ./web_update

Restart the services nginx and php:
sudo service nginx restart && sudo service php7.2-fpm restart

Thanks everyone! I hope this helps someone :slight_smile:

This is some great HowTo and advice - but how will this be affected by updates to MIAB?

This is indeed a working implementation.

In my case, i’ve this kind of config for every different user (just three left over at the moment)

make a softlink to the right position and place your wordpress site; every wordpress site is running unter a different userid and different sock path. (and the user can upload their site with sftp).

One of the issues, why this is not “the ideal solution” is that there are files in /home/user-data/ public readable, for example users.sqllite

Updates of MiaB are not affected

Thanks for pointing out the public folder issue. I reconfigured to have user per site as you said.

Cheers!

I would have instead opt’ed to use SQLite with WP (https://learnwithdaniel.com/2019/06/wordpress-with-sqlite/) instead of doing huge modifications to the server. But awesome little tutorial!