我正在嘗試解決我網站上的以下選項
Strict-Transport-Security
Content-Security-Policy
X-Frame-Options
X-Content-Type-Options
Referrer-Policy
Permissions-Policy
我在 Google 上找到了以下程式碼並將其添加到/etc/apache2/apache2.conf
文件中
<Directory /var/www/html>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
Order Allow,Deny
Allow from all
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Credentials true
Header set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT"
Header set Access-Control-Max-Age "1000"
Header set Access-Control-Allow-Headers "x-requested-with, Content-Type, origin, authorization, accept, client-security-token"
</Directory>
添加上述代碼後,我收到以下錯誤
sudo service apache2 restart
Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xe" for details.
我已在以下 URL 中掃描了我的網站:https://securityheaders.com/,並顯示 F 結果。這是結果連結
我必須解決這些問題,所以我研究了 Google,找到了要新增到 Apache 設定檔中的標頭程式碼。所以我添加了相同的代碼並收到錯誤...