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!

1 Like

Hello, just installed wordpress on computer with MIAB.
There is no problem with nginx. Wordpress can work with it. It means you don’t need Apache
There is no problem to install a database server. mySQL or MariaDB

Generally I have followed these instructions:

But I have choosen the MIAB www folder to install WordPress

What I have done extra:
I have removed the same records which exist in /etc/nginx/sites-enabled/wordpress.conf from /etc/nginx/conf.d/local.conf to avoid duplicates.
I have searched in /etc/nginx/sites-enabled/wordpress.conf records like:
"try_files " and replaced them on “try_files $uri $uri/ /index.php?$args;”

Please pay attention that nginx config records are relevant only to port 443, not 80. (in the instruction above there is wordpress.conf configuration only for port 80)
It means that only that records will change which are inside the following block:

server {
listen 443 ssl http2;
listen [::]:443 ssl http2;

    root /home/user-data/www/example.com;
        index index.php index.html;
        server_name example.com;

And don’t forget to restart ngnix after all amendments in config.
sudo service ngnix restart.

Hope it will help.