Hi Nouran,
Hope you are doing well!
To enable HSTS (http strict transport security), you can edit configuration file like below .
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl default_server;
listen [::]:443 ssl default_server;
ssl_certificate /etc/nginx/certificate/nginx-certificate.crt;
ssl_certificate_key /etc/nginx/certificate/nginx.key;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
server_name _;
location / {
try_files $uri $uri/ =404;
}
}
And to know more about HSTS Please go through with the following documantaion to enable HSTS (http strict transport security):
https://serverfault.com/questions/874936/adding-hsts-to-nginx-confighttps://techexpert.tips/nginx/nginx-enable-hsts/ I hope it will resolve your queries.
Regards
Himanshu Sharma