WordPress: Difference between revisions

imported>Onny
Update instructions on manually package Wordpress plugins
imported>Onny
Add notes about the new settings option
Line 1: Line 1:
[https://wordpress.org Wordpress] is a self-hosted content management web application, especially designed for blogging but also a good way to start creating your own website. It can be customized with themes and a built-in site editor and further extended with plugins.
[https://wordpress.org Wordpress] is a self-hosted content management web application, especially designed for blogging but also a good way to start creating your own website. It can be customized with themes and a built-in site editor and further extended with plugins.
{{Note|Parts of this instruction and module are not yet stable and will be available in the upcoming NixOS 23.05 release.}}


== Installation ==
== Installation ==
Line 13: Line 15:
== Configuration ==
== Configuration ==


It is possible to configure Wordpress setting variables of <code>wp-config.php</code> declarative using the <code>settings</code>. See examples below and [https://developer.wordpress.org/apis/wp-config-php upstream documentation] for available settings.
=== Language ===
=== Language ===


Line 20: Line 24:
services.wordpress.sites."localhost" = {
services.wordpress.sites."localhost" = {
   languages = [ pkgs.wordpressPackages.languages.de_DE ];
   languages = [ pkgs.wordpressPackages.languages.de_DE ];
   extraConfig = ''
   settings = {
     define ('WPLANG', 'de_DE');
     WPLANG = "de_DE";
   '';
   };
};
};
</syntaxHighlight>
</syntaxHighlight>
Line 90: Line 94:


<syntaxHighlight lang="nix">
<syntaxHighlight lang="nix">
extraConfig = ''
settings = ''
   define ('WP_DEFAULT_THEME', 'responsive');
   WP_DEFAULT_THEME = "responsive";
'';
'';
</syntaxHighlight>
</syntaxHighlight>
Line 151: Line 155:


<syntaxHighlight lang="nix">
<syntaxHighlight lang="nix">
services.wordpress.sites."localhost".extraConfig = ''
services.wordpress.sites."localhost" = {
   // Needed to run behind reverse proxy
   settings = {
  define('FORCE_SSL_ADMIN', true);
    // Needed to run behind reverse proxy
   $_SERVER['HTTPS']='on';
    FORCE_SSL_ADMIN = true;
'';
   };
  extraConfig = ''
    $_SERVER['HTTPS']='on';
  '';
};
</syntaxHighlight>
</syntaxHighlight>


Line 277: Line 285:
=== Enable logging ===
=== Enable logging ===


To enable logging add the following lines to <code>extraConfig</code>
To enable logging add the following lines to <code>settings</code> and <code>extraConfig</code>


<syntaxHighlight lang="nix">
<syntaxHighlight lang="nix">
services.wordpress.sites."localhost".extraConfig = ''
services.wordpress.sites."localhost" = {
   define( 'WP_DEBUG', true );
   settings = {
  define( 'WP_DEBUG_LOG', true );
    WP_DEBUG = true;
   ini_set( 'error_log', '/var/lib/wordpress/localhost/debug.log' );
    WP_DEBUG_LOG = true;
'';
   };
  extraConfig = ''
    ini_set( 'error_log', '/var/lib/wordpress/localhost/debug.log' );
  '';
};
</syntaxHighlight>
</syntaxHighlight>


Line 292: Line 304:


<syntaxHighlight lang="nix">
<syntaxHighlight lang="nix">
services.wordpress.sites."localhost".extraConfig = ''
services.wordpress.sites."localhost" = {
  @ini_set( 'display_errors', 1 );
  extraConfig = ''
'';
    @ini_set( 'display_errors', 1 );
  '';
</syntaxHighlight>
</syntaxHighlight>