skip to Main Content

I use bellow command for restart apache:

# ./apachectl restart

But I get bellow error:

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.

my httpd-vhosts.conf is bellow:

[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 [email protected]
 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>

My 37 line is Options -Indexes FollowSymLinks, can you tell me where is the error?

2

Answers


  1. See the docs 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.

    Simply mark the option with + to make clear you want to add it like this:

    Options -Indexes +FollowSymLinks
    
    Login or Signup to reply.
  2. You need to add prefix for both Indexes and FollowSymLinks.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search