Wordpress

Installation

SELinux File-Kontexte korrekt setzen:

semanage fcontext --add --type httpd_sys_rw_content_t "/var/www/html(/.*)?/wp-content(/.*)?"
semanage fcontext --add --type httpd_sys_rw_content_t "/var/www/html(/.*)?/wp-content/upgrade(/.*)?"
semanage fcontext --add --type httpd_sys_rw_content_t "/var/www/html(/.*)?/wp-content/uploads(/.*)?"
semanage fcontext --add --type httpd_sys_script_exec_t "/var/www/html(/.*)?/wp-config\.php"
semanage fcontext --add --type httpd_sys_script_exec_t "/var/www/html(/.*)?/wp-includes/.*\.php"

restorecon -r /var/www/html/www.example.com

Automatisierte WordPress-Pflege

Inkl. automatischer Updates mit Hilfe des WordPress-CLIs („wp-cron“):

crontab
44 */4 chcon --recursive system_u:object_r:httpd_sys_rw_content_t:s0 /var/www/html/www.example.com; wp cron event run --due-now > /dev/null 2>&1; restorecon -r /var/www/html/www.example.com

Update manuell durchführen

WordPress Core, Themes, Plugins und Datenbank aktualisieren:

SITE_PATH=/var/www/html/www.example.com

chcon --recursive system_u:object_r:httpd_sys_rw_content_t:s0 $SITE_PATH

wp core check-update --path=$SITE_PATH
wp core update --path=$SITE_PATH
wp core update-db --path=$SITE_PATH
wp theme update --all --path=$SITE_PATH
wp plugin update --all --path=$SITE_PATH

restorecon -r $SITE_PATH
systemctl restart php-fpm

API Absicherung

Nach der Installation ist die API-Schnittstelle von aussen ohne Authentifizierung erreichbar. Um dies zu unterbinden gibt es die App „Disable REST API“, danach können selektiv API-Rechte vergeben werden.

Für Details siehe c’t 23/2020, S. 28 ff.

Built on 2024-04-18