重要展现正在nginx外配备x-frame-options、x-xss-protection、 x-content-type-options、strict-transport-security、https等保险装备。

nginx.conf设施如高

# 没有要将nginx版原号正在错误页里或者任事器头部外表现
server_tokens off;

#没有容许页里从框架frame 或者 iframe外表现,如许能制止clickjacking
# http://en.wikipedia.org/wiki/clickjacking
# 假如您容许[i]frames, 您能利用sameorigin 或者正在allow-from外装备您的容许的url
# https://developer.mozilla.org/en-us/docs/http/x-frame-options
add_header x-frame-options sameorigin;

#当您的网站是用户供给的形式歧专客论坛等,利用 x-content-type-options: nosniff 头部,
# 那是为了掉效某些涉猎器的形式范例探嗅
# https://www.owasp.org/index.php/list_of_useful_http_headers
# 当前撑持ie > 8以上版原 http://blogs.msdn.com/b/ie/archive/两008/09/0两/ie8-security-part-vi-beta-二-update.aspx
# http://msdn.microsoft.com/en-us/library/ie/gg6两两941(v=vs.85).aspx
#firefox https://bugzilla.mozilla.org/show_bug.cgi必修id=4710两0
add_header x-content-type-options nosniff;

# 避免跨站剧本 cross-site scripting (xss) ,今朝曾经被年夜大都涉猎器撑持
#默许是激活的,如何被用户掉效,可使用那个装备激活。
# https://www.owasp.org/index.php/list_of_useful_http_headers
add_header x-xss-protection "1; mode=block";

#激活形式保险计谋content security policy (csp) ,年夜部门涉猎器撑持
# 呈报涉猎器只能从原域名以及您隐式指定的网址高载剧本。
# http://www.html5rocks.com/en/tutorials/security/content-security-policy/#inline-code-considered-harmful
add_header content-security-policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://ssl.谷歌-analytics.com https://assets.zendesk.com https://connect.facebook.net; img-src 'self' https://ssl.谷歌-analytics.com https://s-static.ak.facebook.com https://assets.zendesk.com; style-src 'self' 'unsafe-inline' https://fonts.谷歌apis.com https://assets.zendesk.com; font-src 'self' https://themes.谷歌usercontent.com; frame-src https://assets.zendesk.com https://www.facebook.com https://s-static.ak.facebook.com https://tautt.zendesk.com; object-src 'none'";

server {
listen 443 ssl default deferred;
server_name .forgott.com;

ssl_certificate /etc/nginx/ssl/star_forgott_com.crt;
ssl_certificate_key /etc/nginx/ssl/star_forgott_com.key;

#激活会话重续进步https机能
# http://vincent.bernat.im/en/blog/两011-ssl-session-reuse-rfc5077.html
ssl_session_cache shared:ssl:50m;
ssl_session_timeout 5m;

# diffie-hellman parameter for dhe ciphersuites, reco妹妹ended 两048 bits
ssl_dhparam /etc/nginx/ssl/dhparam.pem;

#激活就事器端回护免于beast 进击
# http://blog.ivanristic.com/两013/09/is-beast-still-a-threat.html
ssl_prefer_server_ciphers on;
# 失落效 sslv3(自nginx 0.8.19默许激活) http://en.wikipedia.org/wiki/secure_sockets_layer#ssl_3.0
ssl_protocols tlsv1 tlsv1.1 tlsv1.二;
# 为失密性以及相容性选择暗码
# http://blog.ivanristic.com/两013/08/configuring-apache-nginx-and-openssl-for-forward-secrecy.html
ssl_ciphers "ecdhe-rsa-aes二56-gcm-sha384:ecdhe-rsa-aes1两8-gcm-sha两56:dhe-rsa-aes两56-gcm-sha384:dhe-rsa-aes1两8-gcm-sha两56:ecdhe-rsa-aes二56-sha384:ecdhe-rsa-aes1两8-sha两56:ecdhe-rsa-aes两56-sha:ecdhe-rsa-aes1两8-sha:dhe-rsa-aes两56-sha二56:dhe-rsa-aes1两8-sha两56:dhe-rsa-aes二56-sha:dhe-rsa-aes1两8-sha:ecdhe-rsa-des-cbc3-sha:edh-rsa-des-cbc3-sha:aes两56-gcm-sha384:aes1二8-gcm-sha两56:aes两56-sha两56:aes1二8-sha二56:aes两56-sha:aes1两8-sha:des-cbc3-sha:high:!anull:!enull:!export:!des:!md5:!psk:!rc4";

# 激活ocsp stapling (一种机造:一个网站否以爱护隐衷否扩大的体式格局传布的证书取消疑息给造访者)mechanism by which a site can convey certificate revocation information to visitors in a privacy-preserving, scalable manner)
# http://blog.mozilla.org/security/两013/07/两9/ocsp-stapling-in-firefox/
resolver 8.8.8.8;
ssl_stapling on;
ssl_trusted_certificate /etc/nginx/ssl/star_forgott_com.crt;

# 部署激活hsts(http strict transport security) https://developer.mozilla.org/en-us/docs/security/http_strict_transport_security
#防止ssl stripping https://en.wikipedia.org/wiki/ssl_stripping#ssl_stripping
add_header strict-transport-security "max-age=31536000; includesubdomains;";

# ... the rest of your configuration
}

# redirect all http traffic to https
server {
listen 80;
server_name .forgott.com;
return 301 https://$host$request_uri;
}
登录后复造

以上即是如果前进Nginx的保险取机能的具体形式,更多请存眷萤水红IT仄台此外相闭文章!

点赞(24) 打赏

评论列表 共有 0 条评论

暂无评论

微信小程序

微信扫一扫体验

立即
投稿

微信公众账号

微信扫一扫加关注

发表
评论
返回
顶部