WordPress with NGINX on Fedora Server (questions about SELinux)

Hi. I am trying to migrate from Debian Stable to Fedora Server (preferably on ARM), and I have a few questions.

  1. Why should we install WordPress using dnf install wordpress rather than just downloading the files, like it is documented on wordpress.org? Is it because those PHP files won’t work due to SELinux, or is it something else?
  2. If I am importing NGINX config files and database backups (made using msqldump) from another server, do I have to do something with them before they can work?
  3. I have seen is that in the nginx.conf file in Fedora, the user is set to nginx, while on other operating systems it is set to www-data by default. Why is that?

Distribution specific patches, system integration, deployment automation, etc. see:
Tree - rpms/wordpress - src.fedoraproject.org

Try it and reply if you encounter any problems.

Probably for historical reasons and lack of standardization.

Thank you for your reply, and thanks for that link.

So, the database got imported easily using mariadb database_name < database_name.sql.

But the there were problems with downloading/importing NGINX configuration files from sites like nginxconfig.org. I also imported my previous installation to /var/www. The site worked for a while then showed me a 404 error.

If I change server IP in the domain’s DNS, it works for a few minutes and then shows me 404 error. When change the server IP again, it starts working again, but only for a while. So, I made a few more changes in NGINX configuration, but I got stuck with 502 error.

At first, I thought this might be some file ownership issues, so I ran multiple types of chown and chmod commands, but no luck. I wiped the server and will try again, soon. This time, I will probably use dnf install wordpress and configure the NGINX files myself.

Another thing I would like to mention is that Digital Ocean’s NGINX config files generator tool also uses user www-data, and makes us use directories like sites-enabled. While the comments on nginx.confasks us to add config files in conf.d folder.

1 Like

The short answer for an easy life, you probably shouldn’t. There are crazy non-standard settings and a symlink to wp-config in another directory. And updating WP inside the installation is dead easy.

Be aware that using non-default locations often leads to SELinux related issues.
See also: Troubleshooting Problems Related to SELinux :: Fedora Docs

Thanks. I will definitely try that.

Yes, that was my concern. I want to use Fedora Server because of: 1. Better updates. 2. SELinux.

I should probably do what @mac2net said. Update the site inside the installation.

Yes you don’t have to move the installation.

I managed to migrate my website. However, I did not use dnf install wordpress, like @mac2net said, because I want to host 4 WordPress instances on the VPS, so I did what I was doing earlier. I moved the files from the old server to the new one. I did have to change the file ownerships. On usual Debian-based distributions, it would be chown -R www-data:www-data, but on Fedora, it is apache:nginx, even though I am only using NGINX.

However, there is another issue, now. I cannot connect the WordPress to Redis with SELinux set to enforcing. When it is in permissive mode, everything works fine, but in enforcing mode, WordPress says that it cannot connect to the Redis server.

I am not sure what to do now, as I am very new to SELinux. Any help would be appreciated.


EDIT – I used the following commands to make Redis work:
semanage boolean --modify --on httpd_can_network_redis
semanage boolean --modify --on redis_enable_notify

Thank you, everyone.

BTW, I don’t use NGINX, but I tried what you are doing with Apache. Actually prefer Openlitespeed which is a pain to install especially on Fedora but works great and is easy to integrate with both Redis and Memcached.

My suggestion is to turn off SeLinux temporarily to see if that’s the problem. You can easily do this with Cockpit.