指定 Include conf 檔案時 Apache Conf 失敗

指定 Include conf 檔案時 Apache Conf 失敗

我有一個運行良好的 drupal 多站點安裝。自從我設置它以來,這一直困擾著我,我正在努力找出為什麼這不起作用。

當我重新載入 apache 時,當我取消註解“Ininclude conf.d/ip.conf”行時,出現以下錯誤:

allow not allowed here
   ...fail!

如果我指定以下 IP 位址(它們現在已被註解),它就可以工作!

任何建議或幫助將非常感激(顯然這些IP位址不是我正在使用的)。

<Directory "/home/d/r/drupal/web/public_html">
    AllowOverride none

    # Define file limitations on drupal files
    <FilesMatch "(install.php|cron.php|update.php|\.txt)$">
        Order deny,allow
#=================================================================
# THIS DOES NOT WORK? I GET AN ERROR RESTARTING APACHE FOR IP.CONF
        Include conf.d/ip.conf
#=================================================================
# SO I MANUALLY ADD THE IP ADDRESSES HERE:
#Allow from 123.123.123.123
#Allow from 222.222.222.222
#Allow from 555.555.555.555
        Deny from all
    </FilesMatch>

   <FilesMatch "robots.txt">
      Allow from all
   </FilesMatch>

    # Read in Drupal default .htaccess file asif conf - easier CVS management
    Include /home/d/r/drupal/web/public_html/.htaccess

        # Offline mode for multisite setup - see file for more info
        # Uncomment the line below to set sites offline
    # Include conf.d/offline.conf

</Directory>

# Sorry, no svn peeking
<DirectoryMatch "\.svn">
    # Currently pointing back to drupal
    # High traffic sites might want custom
    # error pages, no need to load drupal
    ErrorDocument 403 /index.php
    Order allow,deny
    Deny from all
    Satisfy All
</DirectoryMatch>

# Allow the .htacces files to be used in the sites folder where /files are stored
<Directory "/home/d/r/drupal/web/public_html/sites">
    AllowOverride
</Directory>

ip.conf 看起來像這樣:

Allow from 123.123.123.123
Allow from 222.222.222.222
Allow from 555.555.555.555

答案1

導致此問題的原因是 apache2.conf 正在載入 conf.d 中的所有檔案(包括 conf.d/*),這表示 ip.conf 被載入到錯誤的位置。這意味著這些allow from陳述是斷章取義的。

相關內容