nginx config for PCI-DSS, HIPPA, and NIST compliance
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Nginx Compliance Config

Table of Contents

  1. Overview
  2. Reference Platform Requirements
  3. Website SSL Config/Vulnerability Scanners
  4. SSL Cert/Pem File Notes
  5. OSCP Testing


Example configuration of Nginx for security compliance.

  • NIST
  • Common best practices

Reference Platform Requirements

  • Nginx ~1.10 (v1.3+ required)
  • CentOS7 (This shouldn't matter)

Website SSL Config/Vulnerability Scanners

High-tech Bridge - SSL Server Security Test


SSL Scan Results

  • A+
  • NIST compliance

High-tech Bridge - Web Server Security Test


WebSec Scan Results

  • A
  • HTTP/1.1 and HTTP2
  • Webserver does not send detailed information about its version
  • STRICT-TRANSPORT-SECURITY - The header is properly set.
  • PUBLIC-KEY-PINS - The header was not sent by the server.
  • X-FRAME-OPTIONS - The header is properly set.
  • X-XSS-PROTECTION - The header is properly set.
  • X-CONTENT-TYPE-OPTIONS - The header is properly set.
  • CONTENT-SECURITY-POLICY - Content-Security Policy is enforced. Some directives have values that are too permissive, like wildcards.

SSL Labs


SSL Labs Scan Results

  • A+
  • Certificate: 100/100
  • Support Protocol: 98/100
  • Key Exchange: 90/100
  • Cipher Strength: 90/100
  • HTTP Strict Transport Security (HSTS) with long duration deployed on this server.
  • TLS v1.1 + v1.2
  • Secure Renegotiation Supported
  • Secure Client-Initiated Renegotiation No
  • Insecure Client-Initiated Renegotiation No
  • POODLE (SSLv3) No, SSL 3 not supported
  • Downgrade attack prevention Yes, TLS_FALLBACK_SCSV supported
  • SSL/TLS compression No
  • RC4 No
  • Heartbeat (extension) Yes
  • Heartbleed (vulnerability) No
  • Forward Secrecy Yes
  • ALPN No
  • NPN Yes h2 http/1.1
  • Session resumption (caching) Yes
  • Session resumption (tickets) Yes
  • OCSP stapling Yes
  • Strict Transport Security (HSTS) Yes
  • Incorrect SNI alerts No
  • Uses common DH primes No
  • DH public server param (Ys) reuse No
  • HTTP server signature nginx



  • All green checks
  • OCSP Staple: Good
  • OCSP Origin: Good
  • CRL Status: Good

SSL Cert/Pem File Notes


Single CRT files from certificate authorities cannot be used. In this configuration we need a PEM format x509 certificate file. This includes the signed CRT and all intermediary CA certificates but not the External Root CA certificate. Adding the root ca cert will result in an error.

Creation example if you have the SSL chain file already:

cat COMODORSADomainValidationSecureServerCA.crt COMODORSAAddTrustCA.crt > /etc/ssl/ssl-bundle.pem

Intermediary Chain Creation Help

[] -> Generate the Correct Chain -> paste in your signed CRT (public key) -> ensure Include Root Certificate box is not checked -> click Generate Chain. This is supposed to create a PEM chain file with all intermediary CA certs. With this to create the ssl_certificate you can just cat > /etc/ssl/ssl-bundle.pem


This is simply the private key file you used to create the CSR request before sending it off to the CA to be signed.

Creation Example:

openssl genrsa -out 2048


The Diffie-Hellman algorithm provides the capability for two communicating parties to agree upon a shared secret between them. A unique 2048+ bit DH secret is required and can be easily created with openssl.

Creation Example:

openssl dsaparam -out /etc/ssl/dsaparam.pem 4096 # A 4096 bit key will be considered strong for some time.


The trusted certificate file is used internally by Nginx and it required for OCSP. The PEM format file is the signed CRT, combined with all intermediary CA certs, combined with the final external CA root cert. We use the previously created ssl-bundle.pem file and combine it with the CA provided CA root authority cert. If they don't provide it google is your friend.

Creation Example if you have the full chain already:

cat /etc/ssl/ssl-bundle.pem /etc/ssl/ > /etc/ssl/

Full Chain Creation Help

[] -> Generate the Correct Chain -> paste in your signed CRT (public key) -> check Include Root Certificate box -> click Generate Chain. This creates a PEM chain file with root cert for use with OCSP. After you download the generated CRT file you can just cat > /etc/ssl/

OSCP Testing

OCSP compliance can be split into 2 parts. Nginx configuration settings and a properly created ssl_trusted_certificate PEM file. If you have properly configured Nginx config but have a misconfigured ssl_trusted_certificate PEM file, you will have positive opensssl s_client test results and fail complete online OCSP validation scans. For help tracking down intermediary and root certs use: openssl x509 -in /etc/ssl/file.crt -text -noout

Nginx Configuration Settings

    ssl_stapling on;
    ssl_stapling_verify on;
    # Google public DNS servers used in example
    resolver valid=300s;
    resolver_timeout 2s;
    ssl_trusted_certificate "/etc/ssl/";

openssl Test command: openssl s_client -connect -tls1_2 -tlsextdebug -status

openssl Positive Test Result Example

OCSP response: 
OCSP Response Data:
    OCSP Response Status: successful (0x0)
    Response Type: Basic OCSP Response
    Version: 1 (0x0)
    Responder Id: 2033CDB761Fxxxxxxxxxxxxxxxxxxxxxxxxxx
    Produced At: Mar 20 20:00:04 2017 GMT
    Certificate ID:
      Hash Algorithm: sha1
      Issuer Name Hash: BCA4275C75FEFF061Exxxxxxxxxxxxxxxxxxxxxxx
      Issuer Key Hash: 2033CDwwwwwwwwwwwwwwwwwwwwwwwwwww
      Serial Number: yyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
    Cert Status: good
    This Update: Mar 20 20:00:04 2017 GMT
    Next Update: Mar 27 20:00:04 2017 GMT

    Signature Algorithm: sha256WithRSAEncryption