Important Notes
- Configuration Files: The following steps require editing your unique NGINX configuration files located in
/etc/nginx/conf.d/
. You can open them all using: - Deployment: Newer JetPatch deployments may already have some hardening measures enabled by default. Verify your configuration and adjust as needed.
- Custom Paths: If your configuration files are stored on custom mounts or non‑default paths, update the paths in these instructions accordingly.
- Backup: Always back up your configuration before making changes. For Example:
sudo cp -r /etc/nginx /tmp/nginx_backup
Enforcing HSTS
HSTS (HTTP Strict Transport Security) forces browsers to use HTTPS for your site, reducing downgrade attack risks. To enforce HSTS:
- Open your HTTPS server block configuration (commonly in
/etc/nginx/conf.d/intigua.nginx.conf
). - Add the following line after the second
server {
tag and before any error page definitions (e.g., beforeerror_page 502 /static/502.html
):- max-age=31536000 sets HSTS for one year.
- includeSubDomains applies the policy to all subdomains.
TLS/SSL Cipher Hardening
To protect data in transit, ensure that only modern TLS protocols and strong cipher suites are used. In your SSL configuration (typically found in your HTTPS server block in /etc/nginx/conf.d/intigua.nginx.conf
or an included SSL file), update the settings as follows:
Placement:
These directives must be placed within the SSL context of your server block (i.e., where you have listen 443 ssl;
). This ensures they apply to all secure connections.
Mask Internal Network Names / Private IP Addresses
To prevent leaking internal hostnames or IP addresses in responses, modify your main configuration file:
- Open
/etc/nginx/nginx.conf
in an editor. - Within the
http {}
block, add a default server block as follows:
This configuration forces NGINX to use “localhost” in any responses where an internal name might otherwise be exposed.
Hide the NGINX Version
Hiding the NGINX version in responses helps reduce the information available to attackers.
- In
/etc/nginx/nginx.conf
, within thehttp {}
block, add:
This directive removes version details from the Server header and error pages.
Test and Restart NGINX
After applying the changes, test your configuration:
If the output confirms that the configuration syntax is OK, reload or restart NGINX:
If you receive any warnings (e.g., about deprecated directives), update or remove the indicated lines as needed.
Comments
0 comments
Please sign in to leave a comment.