我在这里和 Google 上搜索了几个文档,但无济于事,我在运行于 ubuntu 16.0 的 apache2 上的默认文档根目录 (/var/www/html) 中添加了一个 .htaccess 文件。在我的 /etc/apache2/apache2.conf 文件中,我也尝试这样做:
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
到:
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
但是我的 .htaccess 文件没有执行...我尝试向我的 .htaccess 文件中添加一些虚拟文本,但仍然不起作用。我已检查过我的 .htaccess 文件的有效性http://www.htaccesscheck.com/并且我的 .htaccess 文件没有问题..
这是我的 .htaccess 文件的副本
#Dont touch
# Indexing index.php
DirectoryIndex index.php index.html
# Error pages
ErrorDocument 400 /errorfiles/400.html
ErrorDocument 401 /errorfiles/401.html
ErrorDocument 403 /errorfiles/403.html
ErrorDocument 404 /errorfiles/404.html
ErrorDocument 500 /errorfiles/500.html
# disable directory browsing
Options ExecCGI Includes IncludesNOEXEC SymLinksIfOwnerMatch -Indexes
这就是我的错误日志所说的
[Fri Jan 12 11:35:54.273813 2018] [mpm_event:notice] [pid 25427:tid 13978013479$
[Fri Jan 12 11:35:54.273873 2018] [core:notice] [pid 25427:tid 139780134791040]$
[Fri Jan 12 11:39:52.533648 2018] [mpm_event:notice] [pid 25427:tid 13978013479$
[Fri Jan 12 11:39:53.594378 2018] [mpm_event:notice] [pid 25656:tid 13991752895$
[Fri Jan 12 11:39:53.594440 2018] [core:notice] [pid 25656:tid 139917528958848]$
[Fri Jan 12 11:40:49.182465 2018] [mpm_event:notice] [pid 25656:tid 13991752895$
[Fri Jan 12 11:40:50.242188 2018] [mpm_prefork:notice] [pid 27360] AH00163: Apa$
[Fri Jan 12 11:40:50.242239 2018] [core:notice] [pid 27360] AH00094: Command li$
[Fri Jan 12 11:40:51.521464 2018] [mpm_prefork:notice] [pid 27360] AH00169: cau$
[Fri Jan 12 11:40:52.645238 2018] [mpm_prefork:notice] [pid 27476] AH00163: Apa$
[Fri Jan 12 11:40:52.645278 2018] [core:notice] [pid 27476] AH00094: Command li$
[Fri Jan 12 11:41:05.370691 2018] [mpm_prefork:notice] [pid 27476] AH00169: cau$
[Fri Jan 12 11:41:06.427807 2018] [mpm_prefork:notice] [pid 27561] AH00163: Apa$
[Fri Jan 12 11:41:06.427850 2018] [core:notice] [pid 27561] AH00094: Command li$
[Fri Jan 12 11:46:15.963404 2018] [:error] [pid 27597] [client 41.66.255.110:35$
[Fri Jan 12 12:06:58.048553 2018] [mpm_prefork:notice] [pid 27561] AH00169: cau$
[Fri Jan 12 12:06:59.130686 2018] [mpm_prefork:notice] [pid 27713] AH00163: Apa$
[Fri Jan 12 12:06:59.130727 2018] [core:notice] [pid 27713] AH00094: Command li$
[Fri Jan 12 12:39:43.402867 2018] [mpm_prefork:notice] [pid 27713] AH00169: cau$
抱歉,这是续篇
[Fri Jan 12 12:39:43.402867 2018] [mpm_prefork:notice] [pid 27713] AH00169: cau$
[Fri Jan 12 12:39:44.479303 2018] [mpm_prefork:notice] [pid 27935] AH00163: Apa$
[Fri Jan 12 12:39:44.479341 2018] [core:notice] [pid 27935] AH00094: Command li$
[Fri Jan 12 12:39:48.447223 2018] [mpm_prefork:notice] [pid 27935] AH00169: cau$
[Fri Jan 12 12:39:49.503253 2018] [mpm_prefork:notice] [pid 27995] AH00163: Apa$
[Fri Jan 12 12:39:49.503294 2018] [core:notice] [pid 27995] AH00094: Command li$
[Fri Jan 12 12:40:09.668870 2018] [core:alert] [pid 28002] [client 41.66.255.11$
[Fri Jan 12 12:42:08.004183 2018] [mpm_prefork:notice] [pid 27995] AH00169: cau$
[Fri Jan 12 12:42:09.064352 2018] [mpm_prefork:notice] [pid 28058] AH00163: Apa$
[Fri Jan 12 12:42:09.064394 2018] [core:notice] [pid 28058] AH00094: Command li$
[Fri Jan 12 13:14:10.396661 2018] [mpm_prefork:notice] [pid 28058] AH00169: cau$
[Fri Jan 12 13:14:11.444968 2018] [mpm_prefork:notice] [pid 28191] AH00163: Apa$
[Fri Jan 12 13:14:11.445006 2018] [core:notice] [pid 28191] AH00094: Command li$
[Fri Jan 12 13:15:23.882928 2018] [core:alert] [pid 28196] [client 41.66.255.11$
[Fri Jan 12 13:18:06.442135 2018] [mpm_prefork:notice] [pid 28191] AH00169: cau$
[Fri Jan 12 13:19:41.544214 2018] [mpm_prefork:notice] [pid 28282] AH00163: Apa$
[Fri Jan 12 13:19:41.544256 2018] [core:notice] [pid 28282] AH00094: Command li$
[Fri Jan 12 14:12:06.208682 2018] [mpm_prefork:notice] [pid 28282] AH00169: cau$
[Fri Jan 12 14:12:07.286856 2018] [mpm_prefork:notice] [pid 28502] AH00163: Apa$
[Fri Jan 12 14:12:07.286897 2018] [core:notice] [pid 28502] AH00094: Command li$
[Fri Jan 12 14:12:59.228236 2018] [core:alert] [pid 28508] [client 41.66.255.11$
[Fri Jan 12 14:20:17.281456 2018] [core:alert] [pid 28505] [client 41.66.255.11$
[Fri Jan 12 14:20:53.223902 2018] [mpm_prefork:notice] [pid 28502] AH00169: cau$
[Fri Jan 12 14:20:54.282339 2018] [mpm_prefork:notice] [pid 28570] AH00163: Apa$
[Fri Jan 12 14:20:54.282384 2018] [core:notice] [pid 28570] AH00094: Command li$
[Fri Jan 12 14:20:59.132006 2018] [core:alert] [pid 28575] [client 41.66.255.11$
[Fri Jan 12 14:27:17.987127 2018] [core:alert] [pid 28576] [client 41.66.255.11$
[Fri Jan 12 14:27:35.697848 2018] [core:alert] [pid 28574] [client 41.66.255.11$
[Fri Jan 12 14:28:05.961142 2018] [core:alert] [pid 28573] [client 188.166.189.$
我发现我的最后五个错误都是这个的延续,因为我的错误被截断了,我不知道如何在这里复制所有内容
/var/www/html/.htaccess: Either all Options must start with + or -, or no Option may.
答案1
我已经自己解决了,非常感谢,特别是所有帮助过我的人,我在我的.htaccess文件中进行了更改:
从:
Options ExecCGI Includes IncludesNOEXEC SymLinksIfOwnerMatch -Indexes
到:选项 +SymLinksIfOwnerMatch +ExecCGI +Includes +IncludesNOEXEC -Indexes,因为错误说所有选项都必须以 + 或 - 开头,或者没有选项可以