Nginx Directives are ignored when a directive is selected in “Web server config”

Discussion in 'Installation/Configuration' started by Pyanepsion, Dec 31, 2025.

  1. Pyanepsion

    Pyanepsion Member

    Context
    • ISPConfig
    • Menu: Site → Website
    • Web server: Nginx
    Affected fields
    • Domain → Web server config (selection of an Nginx directive)
    • Options → nginx Directives (site-specific Nginx directives)
    Reproduction steps
    1. On a site without any Nginx directive selected in Web server config, enter the following in
      Options → nginx Directives:
      Code:
      location = /testing.php {
         return 404;
      }
    2. Save the site.
    3. Check the effective Nginx configuration:
      Code:
      nginx -T 2>/dev/null | grep -qF "testing.php" && echo "FOUND" || echo "ABSENT"
      Result: FOUND
    4. On the same site, select any Nginx directive in Web server config, then save.
    5. Run the same check again:
      Code:
      nginx -T 2>/dev/null | grep -qF "testing.php" && echo "FOUND" || echo "ABSENT"
      Result: ABSENT
    6. Remove the directive from Web server config, save again, and repeat the test.
      Result: FOUND
    Observed behavior
    • When no directive is selected in Web server config, the content of nginx Directives is injected into the generated Nginx configuration.
    • As soon as a directive is selected in Web server config, the content of nginx Directives is completely ignored.
    • The text remains visible in the interface, but is no longer written to the Nginx configuration files.
    Expected behavior
    • Web server config should provide a general configuration.
    • nginx Directives should provide site-specific overrides or additions.
    • Both mechanisms should be cumulative.
    • In case of conflicts, site-specific directives should override, not disappear.
    Conclusion
    Selecting an Nginx directive in Web server config silently disables the nginx Directives field.

    This behavior is either:
    • a bug in the configuration generator, or
    • a deliberate but undocumented behavior (and improper, because illogical) that should be made explicit.
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Neither expected nor intended behaviour. If you have used Nginx before, then you would know that Nginx does not work this way, where you can simply override anything by specifying it later again in a different way.

    That's exactly how it should work. Thank you for confirming it works correctly. Predefined snippets take precedence over manually configured settings. If you want to use snippets with manual config, use the Nginx directives field. The snippets are all listed below the Nginx directives field to be inserted with a single click.

    nginx-snippets.png

    It's not a bug.

    It's a known feature and also logical, as you can either use managed snippets or custom rules, but not both, as Nginx cannot always automatically blend directives, unlike Apache. If you want to manually configure rules, use the custom directives field, which also gives you the ability to insert rules from the rules library.
     
    Last edited: Dec 31, 2025
    ahrasis likes this.
  3. till

    till Super Moderator Staff Member ISPConfig Developer

    ahrasis likes this.
  4. Pyanepsion

    Pyanepsion Member

    Thank you for the clarification and for creating the feature request.
    This will make the behavior much clearer for users.
    It is however important that the field content is not deleted, so it can be restored if the directive is later removed.
     

Share This Page