• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here:Home » Nginx Configuration for HSTS Preload

By Abhishek Ghosh September 12, 2014 8:35 am Updated on September 15, 2014

Nginx Configuration for HSTS Preload

Advertisement

Chrome, Firefox, Safari will at least check a website in the list of HSTS Preloading. Here is the right Nginx configuration for HSTS preload. We have talked about What is HTTP Strict Transport Security (HSTS) Preload List in the previously published article. Here is the working Nginx Configuration for HSTS Preload Test Passing.

 

Nginx Configuration for HSTS Preload : Before We Begin

 

This configuration is for Rackspace Cloud and we use fully default settings of Nginx. You should read the previous guide – SSL Grade Optimization Tweak For Rackspace Cloud Server. Basically, 90% has been done on the older guides. Smaller tweak is required to get the thing we want. It is, very easy.

Nginx Configuration for HTTS Preload

 

Nginx Configuration for HSTS Preload

 

Vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples
server {
listen 80;
listen [::]:80 ipv6only=on;
 
# rest of the all stuffs will be here
# we skipped to HTTPS
# Includes HSTS Preload
}
 
# HTTPS server
#
server {
listen 443 ssl spdy default;
keepalive_timeout   70;
server_name thecustomizewindows.com;
server_tokens off;
add_header X-Frame-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
        root /usr/share/nginx/html;
        index index.php index.html index.htm;
    ssl on;
access_log off;
spdy_headers_comp 0;
    ssl_certificate /etc/nginx/ssl/thecustomizewindows.com.crt;
    ssl_certificate_key /etc/nginx/ssl/thecustomizewindows.com.key;
    ssl_dhparam /etc/nginx/ssl/dhparam.pem;
    ssl_session_timeout 10m;
    ssl_session_cache shared:NginxCache123:50m;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-ECDSA-RC4-SHA:RC4-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK';
ssl_prefer_server_ciphers on;
    ssl_stapling on;
    ssl_stapling_verify on;
    ssl_trusted_certificate /etc/nginx/ssl/signed_cert_plus_intermediate.crt;
resolver 8.8.8.8 8.8.4.4 valid=86400;
add_header Strict-Transport-Security 'max-age=31536000; includeSubDomains; preload';
        location ~ \.php$ {
        #       fastcgi_split_path_info ^(.+\.php)(/.+)$;
        #       # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
        #
        #       # With php5-cgi alone:
                # fastcgi_pass 127.0.0.1:9000;
        #       # With php5-fpm:
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_param PHP_VALUE "upload_max_filesize = 100M \n post_max_size=101M";
                fastcgi_index index.php;
fastcgi_buffer_size 128k;
fastcgi_buffers 256 16k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
include fastcgi_params;
 
# BEGIN W3TC stuffs
## W3C stuffs here
# END W3TC stuffs
 
        }
       location / {
               try_files $uri $uri/ /index.php;
       }
}
# if more thing exits will go here

All are discussed before. This is enough to get a A+ on SSLlabs test :

Advertisement

---

Vim
1
2
3
4
5
6
7
https://www.ssllabs.com/ssltest/analyze.html?d=thecustomizewindows.com
# this will give you
# our result, which is
  Certificate 100
  Protocol Support 95
  Key Exchange 90
  Cipher Strength 90

To generate the dhparam.pem file, you will run :

Vim
1
2
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
# /etc/nginx/ssl/ is my path

Yes, security or grade can be increased more, but Windows and Internet Explorer will create problems :

Vim
1
https://www.ssllabs.com/ssltest/viewClient.html?name=IE&version=6&platform=XP

Tagged With hsts preload nginx , HSTS Preloading nginx , add preload nginx , controller config hsts-preload: true in nginx controller , g /usr/share/doc/nginx-doc/examples/ , https://yandex ru/clck/jsredir?from=yandex ru;search;web;;&text=&etext=1838 5xwqHZCYw8RlXNY7QNOVr59tHNQdBN_SA_I-dKZJmHURsNjPdC8HSfkmf5xvKUTG b2d1432caf345732dc04fab00aec24e76bbcc0b5&uuid=&state=_BLhILn4SxNIvvL0W45KSic66uCIg23qh8iRG98qeIXme , Spring Attribute preload HSTS
Facebook Twitter Pinterest

Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to Nginx Configuration for HSTS Preload

  • SSL Grade Optimization Tweak For Rackspace Cloud Server

    Here are the tweaks for SSL Grade Optimization for Rackspace Cloud Server for a typical Nginx web server. We have also explained the terms.

  • Install/Renew SSL Cert on Apache (2020 Cipher Suites)

    Those who are following us since many years know that we publish the updated server guides enough for a newbie to build and run a professional-grade quality. Renew and getting a new (paid) SSL certificate has little difference except – you may use the old CSR, Private Key and the intermediate certificate. Reusing the old […]

  • Steps to Install NextCloud on Cloud Server (Nginx, Redis Cache)

    Here Are the Steps to Install NextCloud on Cloud Server With Nginx Server, Redis Cache, 2 FA, HTTPS. NextCloud is Like Your Own Dropbox.

  • Generate CSR, Private Key With SHA256 Signature

    Here is how to generate CSR, Private Key with SHA256 signature with OpenSSL for either reissue or new request to get SSL/TLS Certificate.

performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (24.3K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • Hybrid Multi-Cloud Environments Are Becoming UbiquitousJuly 12, 2023
  • Data Protection on the InternetJuly 12, 2023
  • Basics of BJT TransistorJuly 11, 2023
  • What is Confidential Computing?July 11, 2023
  • How a MOSFET WorksJuly 10, 2023
PC users can consult Corrine Chorney for Security.

Want to know more about us?

Read Notability and Mentions & Our Setup.

Copyright © 2023 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy