Configurando HSTP (HTTP Strict Transport Security) – Apache/Nginx

Por enquanto essa configurando será apenas para o apache.

Para saber mais sobre HSTP acesse.

Verificação do módulo

Valide se o módulo heards está habilitado em seu servidor executando:

# apache2ctl -M |grep head

Deveria mostrar algo como:

Essa verificação pode ser feita também observando se existe o arquivo /etc/apache2/mods-enabled/headers.load.

Caso não tenha o módulo habilitado, habilite com o comando abaixo e reiniciei o serviço:

# a2enmod headers
# systemctl restart apache2

Configuração HSTS

Edite o arquivo do seu site, como por exemplo /etc/apache2/sites-enabled/default-ssl.conf

E adicionei a linha como abaixo:

<VirtualHost *:443>
...
Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains"
...
</VirtualHost>

FONTES

https://ubiq.co/tech-blog/enable-mod_headers-apache-ubuntu/
https://www.tecmint.com/check-apache-modules-enabled/
https://www.rfc-editor.org/rfc/rfc6797#section-2

Marcado com , , ,