提问者:小点点

为什么我的Apache2。htaccess文件CORS头导致500内部服务器错误?


我试图启用CORS访问我的Apache2 Web服务器上的目录。我启用了. htaccess文件,并添加了一行用于启用对目录的CORS访问。

Header set Access-Control-Allow-Origin: "*"

在保存后。htaccess文件在这一行中,我在尝试访问目录时遇到一个500内部服务器错误(http://williamgreen.hopto.org/audio/).

有什么想法吗?我的标题不正确吗?谢谢你。

Apache2error.log:

[2017年3月9日星期四15:02:15.118686][mpm_事件:通知][pid 2668:tid 547718139904]AH00489:Apache/2.4。18(Ubuntu)已配置--恢复正常操作
[Thu Mar 09 15:02:15.119080 2017][core:notice][pid 2668:tid 547718139904]AH00094:命令行:'/usr/sbin/apache2'
[Thu Mar 09 19:27:09.148771 2017][MPU事件:notice][pid 2668:tid 547718139904]AH00491:,关闭[Thu Mar 09 19:27:10.339942 2017][mpm_事件:通知][pid 14385:tid 548172222464]AH00489:Apache/2.4。18(Ubuntu)已配置--恢复正常操作
[Thu Mar 09 19:27:10.340300 2017][core:notice][pid 14385:tid 548172222464]AH00094:命令行:'/usr/sbin/apache2'
[Thu Mar 09 19:39:47.583449 2017][MPU事件:notice][pid 14385:tid 548172222464]AH00491:,关闭[2017年3月9日星期四19:39:47.776394][mpm_事件:通知][pid 14915:tid 548543827968]AH00489:Apache/2.4。18(Ubuntu)已配置--恢复正常操作
[Thu Mar 09 19:39:47.776776 2017][core:notice][pid 14915:tid 548543827968]AH00094:命令行:'/usr/sbin/apache2'
[Thu Mar 09 19:39:51.201462 2017][core:alert][pid 14919:tid 548512096688][client 73.15.129.28:57278][var/www/html/audio。htaccess:无效的命令“Header”,可能拼写错误或由服务器配置中未包含的模块定义,请参阅:http://williamgreen.hopto.org/audio/Music/
[2017年3月9日星期四19:39:51.204818][core:alert][pid 14918:tid 548528873904][client 73.15.129.28:57280]/var/www/html/audio/。htaccess:无效的命令“Header”,可能拼写错误或由服务器配置中未包含的模块定义,请参阅:http://williamgreen.hopto.org/audio/Music/
[2017年3月9日星期四19:39:55.389791][core:alert][pid 14918:tid 548520485296][client 73.15.129.28:57279]/var/www/html/audio/。htaccess:无效的命令“Header”,可能拼写错误或由未包含在服务器配置中的模块定义
[Thu Mar 09 19:40:02.264113 2017][core:alert][pid 14918:tid 548512096688][client 73.15.129.28:57283]/var/www/html/audio/。htaccess:无效的命令“Header”,可能拼写错误或由未包含在服务器配置中的模块定义
[Thu Mar 09 19:40:03.735693 2017][core:alert][pid 14919:tid 54850370880][client 73.15.129.28:57284]/var/www/html/audio/。htaccess:无效的命令“Header”,可能拼写错误或由未包含在服务器配置中的模块定义
[Thu Mar 09 19:40:04.183378 2017][core:alert][pid 14918:tid 54850370880][client 73.15.129.28:57285]/var/www/html/audio/。htaccess:无效的命令“Header”,可能拼写错误或由服务器配置中未包含的模块定义
[Thu Mar 09 19:40:04.527274 2017][core:alert][pid 14919:tid 548520485296][client 73.15.129.28:57286]/var/www/html/audio/。htaccess:无效的命令“Header”,可能拼写错误或由服务器配置中未包含的模块定义
[Thu Mar 09 19:40:04.846900 2017][core:alert][pid 14919:tid 548495319472][client 73.15.129.28:57287]/var/www/html/audio/。htaccess:无效的命令“Header”,可能拼写错误或由服务器配置中未包含的模块定义


共1个答案

匿名用户

您没有安装标头模块。使用apache2,只需运行a2enmod头文件,然后sudo service apache2重启,它将自动安装头文件模块。