To enable OCSP Stapling on NGINX:
- First check that NGINX 1.3.7 or above is installed by running the following command:
Versions lower than 1.3.7 do not support OCSP stapling, so you should update NGINX before proceeding with the rest of this tutorial.
- Check whether OCSP stapling is already enabled or not:
- Go to Qualys SSL Server Test, enter your website address and click ‘Analyze’
- Scroll down to ‘Certificate Status Details’
- If OCSP is enabled, the “OCSP Stapling” row will say ‘Good’
- If OCSP is not enabled, the “OCSP Stapling” row will say ‘Not Supported’
Alternatively, you can check by running the following OpenSSL command:
openssl s_client -connect [my-domain.com]:443 -status
If OCSP is enabled, the OCSP Response Data section should say:
OCSP Response Status: successful (0x0)
If it is not enabled, you won’t see any OCSP Response Data.
- If step 2 revealed no evidence that OCSP is enabled on your server, it is first worth checking that NGINX can actually connect to our OCSP servers. Our OCSP servers are at the following locations:
184.108.40.206 or 2a02:1788:2fd::b2ff:5301
To check connectivity, use the following telnet command:
telnet OCSP.ComodoCA.com 80
If the test is successful the reply will state ‘Connected to OCSP.ComodoCA.com’ for at least one of the ‘Destination IP’ addresses in the table above.
If the test is unsuccessful the replies will state ‘Network Unreachable’ and/or ‘Connection Timed Out’. Please make the required network changes to allow NGINX to connect to our OCSP servers. Once complete, we advise you to re-run the test in step 2 to establish whether OCSP stapling is already enabled.
- To enable OCSP stapling, first edit the server block configuration file for your site (or nginx.conf if server blocks are not used) using the editor of your choice (example editors include nano or vi):
If you need to enable OCSP stapling on just one server block, it must be the “default_server”. If you need to enable OCSP stapling on more than one server block, it must be enabled on the 'default_server' before it can be enabled on any other server block.
- Turn on OCSP stapling and enable the server to check OCSP by adding the following lines inside the server block:
- Point to a trusted certificate chain file. This must contain the intermediate & root certificates in order
Use the example below as a reference configuration:
listen 443 default_server;
# Change this to point to your document root.
index index.html index.htm;
- Test your configuration is OK:
sudo service nginx configtest
- Restart NGINX if OK:
sudo service nginx reload
systemctl restart nginx
- Verify OCSP Stapling is working by repeating step 2