所有选项都必须以 + 或 - 开头,或者任何选项都不能

Either all Options must start with + or -, or no Option may

我使用以下命令重新启动 apache:

# ./apachectl restart

但我收到以下错误:

AH00526: Syntax error on line 37 of /usr/local/httpd/conf/extra/httpd-vhosts.conf: Either all Options must start with + or -, or no Option may.

我的httpd-vhosts.conf如下:

[root@localhost bin]# vim /usr/local/httpd/conf/extra/httpd-vhosts.conf

 25     DocumentRoot "/usr/local/httpd/htdocs/whmcs"
 26     ServerName 33.hk
 27     ServerAlias http://www.33.hk
 28     ErrorLog "logs/33.hk-error_log"
 29 </VirtualHost>
 30 
 31 <VirtualHost *:80>
 32     #ServerAdmin webmaster@dummy-host2.localhost
 33     DocumentRoot "/usr/local/httpd/htdocs/whmcs/admin"
 34     ServerName 1.33.hk
 35     DirectoryIndex index.php
 36     <Directory "/usr/local/httpd/htdocs/whmcs/admin">
 37       Options -Indexes FollowSymLinks
 38       AllowOverride None
 39       Order allow,deny
 40       Allow from all
 41     </Directory>
 42     ErrorLog "logs/1.33.hk-error_log"
 43     CustomLog "logs/1.33.hk-access_log" common
 44 </VirtualHost>

我的37行是Options -Indexes FollowSymLinks,你能告诉我错误在哪里吗?

查看文档 https://httpd.apache.org/docs/2.4/mod/core.html#options :

Normally, if multiple Options could apply to a directory, then the most specific one is used and others are ignored; the options are not merged. (See how sections are merged.) However if all the options on the Options directive are preceded by a + or - symbol, the options are merged. Any options preceded by a + are added to the options currently in force, and any options preceded by a - are removed from the options currently in force.

只需用 + 标记选项即可表明您要像这样添加它:

Options -Indexes +FollowSymLinks

您需要为索引和 FollowSymLinks 添加前缀。