前面介绍了如何进入OpenLiteSpeed的控制面板。
有些高级功能,还没有集成到CyberPanel中,需要在控制面板中开启。
现在说明一下,如何添加http header
选择 虚拟主机, 选择资源集,点击右上角的添加
类型选择Static, 然后点击右上角的下一步。
URI设置为 / 即全站
位置为网站根目录/home/$VH_NAME/public_html
可访问选是
在额外头部处,添加自己要添加的消息头
比如HSTS消息头为:
Strict-Transport-Security: max-age=15552000
X-Content-Type-Options nosniff
添加完成后,记得重启OLS以生效。
列出一下常用的消息头
Content-Security-Policy default-src 'self' data: 'unsafe-eval' 'unsafe-inline' https://www.google-analytics.com https://ajax.cloudflare.com
X-XSS-Protection 1;mode=block
X-Frame-Options SAMEORIGIN
Referrer-Policy strict-origin-when-cross-origin
Strict-Transport-Security: max-age=15552000
X-Content-Type-Options nosniff
Public-Key-Pins 'pin-sha256="pin1"; pin-sha256="pin2"; max-age=2592000'