在 Apache ubuntu 14 中使用关键字

在 Apache ubuntu 14 中使用关键字

可用文件夹,我想使用虚拟主机功能和重写规则。我已使用终端启用重写规则。在此目录中,我有文件 expand-cq-paths 文件,其内容如下:

<Macro ExpandCqPaths $path>
    RewriteEngine On

    RewriteRule ^/$ $path.html [PT,L]

    RewriteCond %{REQUEST_URI} ^/content
    RewriteCond %{REQUEST_URI} !^/content/campaigns
    RewriteCond %{REQUEST_URI} !^/content/dam
    RewriteRule !^$path - [R=404,L,NC]

    RewriteCond %{REQUEST_URI} !^/apps
    RewriteCond %{REQUEST_URI} !^/content
    RewriteCond %{REQUEST_URI} !^/etc
    RewriteCond %{REQUEST_URI} !^/home
    RewriteCond %{REQUEST_URI} !^/libs
    RewriteCond %{REQUEST_URI} !^/tmp
    RewriteCond %{REQUEST_URI} !^/var
    RewriteRule ^/(.*)$ $path/$1 [PT,L]
</Macro>

我有一个 000-default.conf 文件,内容如下:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /opt/communique/dispatcher/cache
    ServerName geometrixx.com
    <Directory /var/www>
                AllowOverride All
    </Directory>
    <IfModule disp_apache2.c>
        SetHandler dispatcher-handler
    </IfModule>
    Use ExpandCqPaths /content/geometrixx/en
    LogLevel warn
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:80>
    // for different locale
</VirtualHost>  
<VirtualHost *:80>
    // for different locale
</VirtualHost>

问题是当我重新启动 Web 服务器时,它给出了如下错误:

H00526: Syntax error on line 11 of /etc/apache2/sites-enabled/000-default.conf:
Invalid command 'Use', perhaps misspelled or defined by a module not included in the server configuration
Action 'configtest' failed

我该如何解决这个问题?

谢谢

答案1

要使用Use您需要拥有macro模块启用,由提供libapache2-mod-macro

sudo apt-get install libapache2-mod-macro
sudo a2enmod macro
sudo service apache2 restart

相关内容