本文主要是介绍域名配置HSTS支持,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
配置前提:请确保网站已经支持https协议并且所有服务均通过https协议提供。
一、Apache服务器
编辑apache 配置文件:
在/etc/apache2/sites-enabled/website.conf中取消以下内容的注释:
LoadModule headers_module modules/mod_headers.so
在/etc/apache2/httpd.conf增加以下内容至应用的 HTTPS VirtualHost中
Header always Strict-Transport-Security "max-age=63072000; includeSubdomains; preload"
二、Nginx服务器
编辑 Nginx 配置文件(如:/usr/local/nginx/conf/nginx.conf),将下面行添加到你的应用配置的server 块中。
add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload"
三、Lighttpd服务器
将下述配置增加到Lighttpd 配置文件,一般在/etc/lighttpd/lighttpd.conf。
server.modules += ( “mod_setenv” )
$HTTP[“scheme”] == “https” {
setenv.add-response-header = (“Strict-Transport-Security” => “max-age=63072000; includeSubdomains; preload”)
}
这篇关于域名配置HSTS支持的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!