Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation for Wordpress module is misleading #118359

Open
BBBSnowball opened this issue Apr 2, 2021 · 5 comments
Open

Documentation for Wordpress module is misleading #118359

BBBSnowball opened this issue Apr 2, 2021 · 5 comments
Labels
0.kind: bug 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 6.topic: nixos

Comments

@BBBSnowball
Copy link
Contributor

Describe the bug

The Wordpress configuration from the wiki just works. Great! However, I hit a few issues when changing the defaults.

  1. The option services.wordpress.<name>.database.socket claims that the default value is "/run/mysqld/mysqld.sock". See source code. The actual default is null, which does a different thing: It will use the TCP port. Should this be example instead of defaultText?

  2. The option services.wordpress.<name>.virtualHost.locations.<name>.alias has a directory path as an example. I tried to use that to add an extra fonts directory.

The documentation made me think that the following should work:

services.wordpress.name.locations."/extra-fonts".alias = "/var/www/extra-fonts";`

This generates the following configuration for Apache2:

<Location /extra-fonts>
  <IfModule mod_alias.c>
    Alias "/var/www/extra-fonts"
  </IfModule>
</Location>

This is different from the usual Alias "/extra-fonts" "/var/www/extra-fonts" in an important way: It will drop the further parts of the URI. I can't point to any part of the Apache2 documentation that says so (it sort-of doesn't say one or the other) but I have tested both variants and observed that difference.

The URL https://myserver/extra-fonts/myfont.ttf will be aliased to /var/www/extra-fonts (without myfont.ttf). As this is a directory, Apache2 will add a slash and then redirect to the index.html. That part of the URI will again be dropped in the next request. The result is an infinite redirection with ever more "/index.html" until the browser gives up.

This configuration is working for me:

          services.wordpress.name.locations."/extra-fonts" = {
            #alias = "/var/www/extra-fonts";
            alias = "/var/www%{REQUEST_URI}";
            extraConfig = ''
              Require all granted
            '';
          };

I think we should improve the documentation and possibly the available options. My "solution" still feels like an ugly workaround but I don't know enough about Apache to suggest a better one. If we agree on a suitable way forward, I can prepare the PR.

To Reproduce
Steps to reproduce the behavior:

  1. Set the option, observe the behavior described above.

Expected behavior

  • Defaults in the documentation are the actual defaults (or functionally equivalent to those).
  • Example values should work without adjustments or other settings if possible.

Additional context
I'm using this in a declarative container (NixOS' containers option). The server is behind a reverse proxy but I have also tested with curl to the backend server. I'm using NixOS 20.09 but I think the issue is still present in master.

Notify maintainers
@aanderse

Metadata

  • system: "x86_64-linux"
  • host os: Linux 5.4.83, NixOS, 20.09pre-git (Nightingale)
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.4pre20210326_dd77f71
  • nixpkgs: /etc/current-nixpkgs (which points to /nix/store/p86a44r69akjvyg0nid33kh9mg15h9lq-source, which is github:NixOS/nixpkgs/da7f4c4842520167f65c20ad75ecdbd14e27ae91)

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute:
- services.wordpress.<name>.database.socket
- services.wordpress.<name>.virtualHost.locations.<name>.alias
# a list of nixos modules affected by the problem
module:
- services/web-apps/wordpress.nix
@aanderse
Copy link
Member

aanderse commented Apr 2, 2021

I'll take a look at this when I get a chance... but I'm not listed as a maintainer so not sure why you put me as maintainer 😄

@BBBSnowball
Copy link
Contributor Author

Thanks. The template says maintainer or git blame. I didn't see any maintainer in this file (is there another way to find the maintainer?) so I did the latter ;)

@aanderse
Copy link
Member

@BBBSnowball you might want to take a look at #84446. If merged it would make this issue resolved in a sense.

@mohe2015
Copy link
Contributor

I also would recommend you to look at #96910. The most important thing probably is to change name for plugins and themes to pname as otherwise some themes (and maybe plugins) loose settings on updating to another version as the path in the plugins or themes directory changes and they don't find them in the database any more.

@stale
Copy link

stale bot commented Oct 12, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Oct 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 6.topic: nixos
Projects
None yet
Development

No branches or pull requests

4 participants