Skip to content

Hide nginx version number on 404 error pages #24

@iAnonymous3000

Description

@iAnonymous3000

Problem:

The nginx version number is exposed on 404 error pages, which could be a security concern.

Steps to Reproduce:

  1. Navigate to a non-existing page on the server.
  2. Observe the nginx version number displayed on the 404 error page.

Expected Behavior:

The 404 error page should not display the nginx version number.

Proposed Solution:

  • Disable server tokens by adding the directive server_tokens off; in the nginx configuration file to prevent the version number from being displayed.
  • Implement custom error pages for 404 responses to avoid default nginx error pages. This can be done by adding the following to the nginx config:
    error_page 404 /custom_404.html;
    location = /custom_404.html {
        root /path/to/your/error/pages;
        internal;
    }
  • After changes, validate the nginx configuration with nginx -t and apply the changes by reloading nginx using sudo systemctl reload nginx.

Action Items:

  • Update the nginx configuration to hide server tokens.
  • Create and deploy a custom 404 error page.
  • Test the new configuration.
  • Reload nginx to apply changes.

Please ensure configurations are backed up before making any changes. Also, remember to check for any syntax errors with nginx -t before reloading nginx.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions