使用 apache 在 Centos 7 上全新安装 Nextcloud 12。我尚未配置任何内容,但我不断在管理控制台上收到以下错误代码:
X-Frame-Options" HTTP header is not configured to equal to "SAMEORIGIN
X-Content-Type-Options" HTTP header is not configured to equal to "nosniff
我查看了 .htaccess 文件,并且设置了这两个文件,但是当我重新启动 Apache 时,错误仍然存在。
<IfModule mod_env.c>
# Add security and privacy related headers
Header set X-Content-Type-Options "nosniff"
Header set X-Frame-Options "SAMEORIGIN"
Header set X-XSS-Protection "1; mode=block"
Header set X-Robots-Tag "none"
Header set X-Download-Options "noopen"
Header set X-Permitted-Cross-Domain-Policies "none"
SetEnv modHeadersAvailable true
</IfModule>
答案1
嘿,看起来 apache 没有读取 .htaccess 文件,这通常可以通过以下方法修复:
sudo nano /etc/httpd/conf/httpd.conf
DocumentRoot "/var/www/html"
After the section ends<Directory "/var/www/html"> </Directory>
<Directory /var/www/html/nextcloud>
AllowOverride ALL
Require all granted
</Directory>