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

时间:2018-09-20 13:28:49

标签: apache httpd.conf

我使用贝娄命令来重新启动apache:

# ./apachectl restart

但是出现以下错误:

  

AH00526:/usr/local/httpd/conf/extra/httpd-vhosts.conf的第37行的语法错误:   所有选项都必须以+或-开头,否则不能选项。

我的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,您能告诉我错误在哪里吗?

2 个答案:

答案 0 :(得分:1)

请参阅文档https://httpd.apache.org/docs/2.4/mod/core.html#options

  

通常,如果多个选项可以应用于一个目录,则   使用最具体的一种,而忽略其他的;选项不是   合并。 (请参见各节的合并方式。)但是,如果所有选项都在   Options指令前面带有+或-符号,选项为   合并。任何带+的选项都会添加到当前选项中   有效,并且所有以-开头的选项都将从选项中删除   目前有效。

简单地用+标记选项,以表明您想像这样添加它:

Options -Indexes +FollowSymLinks

答案 1 :(得分:0)

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