Register for the iXsystems Community to get an ad-free experience and exclusive discounts in our eBay Store.
Scripted WordPress Installation (for Reverse Proxy)

Scripted WordPress Installation (for Reverse Proxy) 2.3.1

Western Digital Drives - The Preferred Drives of FreeNAS and TrueNAS CORE
One less manual post-installation step to undertake. The configuration of the sendmail file /etc/mail/mailer.conf has been automated. The post-installation tasks for setting up and testing sSMTP has been revised to reflect this change.

There are no changes to the jail between versions 1.4.4 and 1.4.5 of this resource. This revision streamlines the installation phase by having the script do more while further reducing the need for manual post-installation intervention.
Fewer manual post-installation steps are required in this release. The initial configuration of the WordPress configuration file wp-config.php has been fully automated. Previous manual post-installation that have now been integrated into the script include:
  1. Configuring WordPress behind a reverse proxy;
  2. Setup of the WordPress filesystem; and
  3. Configuring Redis.
In addition, this release adds to wp-config.php:
  1. Debug support; and
  2. WP Super Cache plugin support.
If you've run the previous version 1.4.3 of this script and would like to maintain parity with version 1.4.4, add the following code to wp-config.php after the line define( 'WP_DEBUG', false );

Code:
if ( WP_DEBUG ) {
  @error_reporting( E_ALL );
  @ini_set( 'log_errors', true );
  @ini_set( 'log_errors_max_len', '0' );

  define( 'WP_DEBUG_LOG', true );
  define( 'WP_DEBUG_DISPLAY', false );
  define( 'CONCATENATE_SCRIPTS', false );
  define( 'SAVEQUERIES', true );
}

// WP Super Cache plugin support.
define('WP_CACHE', true);
define ('WPCACHEHOME', '/usr/local/www/wordpress/wp-content/plugins/wp-super-cache/');


References:
  1. Debug support: 'Latest update Broke my site'.
  2. WP Super Cache plugin support: WordPress Plugin: WP Super Cache
A Caddy web server serves the PHP files in the WordPress jail. Caddy has been upgraded from v2.2.0 to 2.2.1.

To update your WordPress jail, assuming the jail is named wordpress, enter the jail iocage console wordpress and update Caddy:

Code:
cd /usr/local/bin
fetch https://github.com/caddyserver/caddy/releases/latest/download/caddy_2.2.1_freebsd_amd64.tar.gz
caddy version #2.2.0
service caddy stop
mv caddy caddy_2.2.0
tar xvf caddy_2.2.1_freebsd_amd64.tar.gz
service caddy start
caddy version #2.2.1
rm caddy_2.2.1_freebsd_amd64.tar.gz
Unlike cache plugins, that run from inside the WordPress site and provide frontend caching, Redis is a server-side cache that provides backend caching for WordPress.

To update your WordPress jail if you've run the previous version 1.3.0 of the script, enter the jail iocage console wordpress and execute the following commands:

Code:
pkg update
pkg install redis php74-pecl-redis

Edit the file redis.conf cd /usr/local/etc && ee redis.conf. To reconfigure Redis to listen on a Unix socket rather than a TCP port, uncomment the switches below if necessary, and set to the values shown.

Code:
port 0
unixsocket /var/run/redis/redis.sock
unixsocketperm 770

Save the file. Enable and start the Redis service:

Code:
sysrc redis_enable="YES"
service redis start

Check that the service has started service redis status. If you need to troubleshoot, check the redis log cat /var/log/redis/redis.log.

Allow www to access the Redis socket pw usermod www -G redis

Now, link Redis to WordPress by completing step 5: Configure Redis of the post-installation instructions at https://github.com/basilhendroff/freenas-iocage-wordpress/blob/master/POST-INSTALL.md
The phpMyAdmin program is handy for performing maintenance operations on tables, backing up information, and editing things directly in the event that WordPress is not working. It is referenced quite frequently in WordPress documentation and has been included in this release of the script.

To update your WordPress jail if you've run the previous version 1.2.3 of the script, enter the jail iocage console wordpress and execute the following commands:

Code:
pkg install phpmyadmin5-php74
service php-fpm restart
rm /usr/local/www/phpMyAdmin/config.inc.php
ln -s /usr/local/www/phpMyAdmin /usr/local/www/wordpress/phpmyadmin

Now complete step 8: Configure phpMyAdmin of the post-installation instructions at https://github.com/basilhendroff/freenas-iocage-wordpress/blob/master/POST-INSTALL.md
A Caddy web server serves the PHP files in the WordPress jail. Caddy has been upgraded overnight from v2.1.1 to 2.2.0.

To update your WordPress jail if you've previously run v1.0.0 of the script:
  1. Assuming the jail is named wordpress, enter the jail iocage console wordpress
  2. Install the PHP xmlwriter extension pkg install php74-xmlwriter. This is not for Caddy, but is a requirement of the WordPress UpdraftPlus plugin.
  3. Update Caddy.
Code:
cd /usr/local/bin
fetch https://github.com/caddyserver/caddy/releases/latest/download/caddy_2.2.0_freebsd_amd64.tar.gz
caddy version #2.1.1
service caddy stop
mv caddy caddy_2.1.1
tar xvf caddy_2.2.0_freebsd_amd64.tar.gz
service caddy start
caddy version #2.2.0
rm caddy_2.2.0_freebsd_amd64.tar.gz


In addition, from the FreeNAS GUI, check the WordPress jail mount points.

screenshot.739.png


If you see three entries instead of two, stop the jail, remove the includes entry and then restart the jail. The includes mount point is temporary and only used when the script is run. It is not required for the operation of the WordPress jail.
Top