iis7开启js的gzip压缩

1、启动网站的压缩功能,这个不用说了,网站配置里面就有。
2、编辑该文件 C:\Windows\System32\inetsrv\config\applicationhost.config,查看 httpCompression 节点,看是否有下面两个配置,不管怎样,把这两个都写进去:

<add mimeType="application/x-javascript" enabled="true" />
<add mimeType="application/javascript" enabled="true" />

大概就是下面这样了:

    <httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
        <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />
        <staticTypes>
            <add mimeType="text/*" enabled="true" />
            <add mimeType="message/*" enabled="true" />
            <add mimeType="application/x-javascript" enabled="true" />
            <add mimeType="application/javascript" enabled="true" />
            <add mimeType="application/atom+xml" enabled="true" />
            <add mimeType="application/xaml+xml" enabled="true" />
            <add mimeType="*/*" enabled="false" />
        </staticTypes>
        <dynamicTypes>
            <add mimeType="text/*" enabled="true" />
            <add mimeType="message/*" enabled="true" />
            <add mimeType="application/x-javascript" enabled="true" />
            <add mimeType="application/javascript" enabled="true" />
            <add mimeType="*/*" enabled="false" />
        </dynamicTypes>
    </httpCompression>

标签: none

添加新评论