为特定目录(而不是整个虚拟主机)启用mod_pagespeed

Enable mod_pagespeed for a Specific Directory Instead of Entire Virtual Host

提问人:Hady Shaltout 提问时间:5/24/2023 更新时间:5/24/2023 访问量:30

问:

我在modpagespeed文档中读到,可以在.htaccess文件中启用mod_pagespeed,但不建议这样做,另一部分是在整个虚拟主机中启用PageSpeed,如下所示:

ModPagespeed On
ModPagespeedInheritVHostConfig on
ModPagespeedFileCachePath "/var/cache/mod_pagespeed/"
ModPagespeedEnableFilters combine_css,combine_javascript
# Direct Apache to send all HTML output to the mod_pagespeed
# output handler.
AddOutputFilterByType MOD_PAGESPEED_OUTPUT_FILTER text/html

NameVirtualHost *:80
<VirtualHost *:80>
  DocumentRoot /www/example1
  ServerName www.example1.com
  ModPagespeedMapRewriteDomain cdn.example1.com *example.com
</VirtualHost>

我的问题是:是否可以在虚拟主机内的特定目录中启用 pagespeed,而不是在整个虚拟主机站点中启用?

喜欢这个:

<VirtualHost XXX.XXX.XXX.XXX:80>
    SuexecUserGroup "#1001" "#1001"

    ServerName DOMAIN.com
    ServerAlias www.DOMAIN.com
    ServerAlias mail.DOMAIN.com
    ServerAlias webmail.DOMAIN.com
    ServerAlias admin.DOMAIN.com

    DocumentRoot /home/DOMAIN/public_html

    <Directory /home/DOMAIN/public_html/demo-site/demo-2-site>
        AllowOverride Fileinfo Options

        #============= Something like that ==============
        ModPagespeed On
        ModPagespeedInheritVHostConfig on
        ModPagespeedFileCachePath "/var/cache/mod_pagespeed/"
        ModPagespeedEnableFilters combine_css,combine_javascript
        # Direct Apache to send all HTML output to the mod_pagespeed
        # output handler.
        AddOutputFilterByType MOD_PAGESPEED_OUTPUT_FILTER text/html

    </Directory>

</VirtualHost>
Apache httpd.conf google-pagespeed mod-pagespeed

评论


答: 暂无答案