[Nix-dev] wordpress

Joachim Schiele js at lastlog.de
Fri Jun 10 11:53:49 CEST 2016


On 10.06.2016 02:11, stewart mackenzie wrote:
> It would seem it's very centered around deploying stock releases not
> amenable for developing on wordpress. But I didn't get that far.

your observation is correct.

> Is there a faster route?

you can also deploy wordpress manually as you probably did on your
ubuntu machine. that said:

 services.httpd = {
    enable = true;
    logPerVirtualHost = true;
    adminAddr="js at lastlog.de";
    hostName = "lastlog.de";
    extraModules = [
      { name = "php5"; path = "${pkgs.php}/modules/libphp5.so"; }
      { name = "deflate"; path =
"${pkgs.apacheHttpd}/modules/mod_deflate.so"; }
      { name = "proxy_wstunnel"; path =
"${pkgs.apacheHttpd}/modules/mod_proxy_wstunnel.so"; }
    ];
      virtualHosts =
      [
        # webservice5 (http)
        {
          hostName = "webservice5";
          serverAliases = [ "webservice5"];
          documentRoot = "/www/webservice5";
          extraConfig = ''
            <Directory *>
            <IfModule mod_rewrite.c>
            # subdirectory
            RewriteEngine On
            RewriteBase /
            RewriteRule ^index\.php$ - [L]

            # add a trailing slash to /wp-admin
            RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

            RewriteCond %{REQUEST_FILENAME} -f [OR]
            RewriteCond %{REQUEST_FILENAME} -d
            RewriteRule ^ - [L]
            RewriteRule
^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
            RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
            RewriteRule . index.php [L]
            </IfModule>
            </Directory>

            # both cases needed
            <IfModule mod_dir.c>
              DirectoryIndex index.php index.htm index.html
            </IfModule>
          '';
        }
    ];
  };

then extract the wordpress file to /www/webservice5 and also deploy your
plugins/themes as on other platforms. if you are curious what commands
to use in order to deploy, you can cheat a little by looking into
wordpress.nix

your request made me thinking, we need an intermediate platform where
such webapps are placed into. this means, the environment must also be a
installable attribute which could then, similar to nix-shell
environments for c/c++/python/perl, be used to run php scripts.

i would like to create such a nix-abstraction/platform. if you are
interested, please let me know.

regards,
joachim




More information about the nix-dev mailing list