亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb

首頁 > 網站 > Apache > 正文

通過apache,和nginx模塊去除html中的空格和tab

2024-08-27 18:29:24
字體:
來源:轉載
供稿:網友
通過apache,和nginx模塊去除html中的空格和tab

最近一個項目中,合作方要求去除html中的空格,不想改代碼,所以百度了一下通過apache,和nginx模塊去除html中的空格和tab的方案,下面記錄下來:

一、nginx

nginx可以通過mod_strip模塊來實現該功能

1. mod_strip安裝:

# cd /usr/local/src/# wget http://wiki.nginx.org/images/6/63/Mod_strip-0.1.tar.gz# tar -xzvf Mod_strip-0.1.tar.gz# cd nginx-1.4.2 //提前解壓好的nginx# ./configure --PRefix=/usr/local/nginx-1.4.2 --add-module=../mod_strip# make# make install2. mod_strip簡單用法:

location / { strip on;}strip指令:

語法: strip on|off默認: off可用配置段: main, http, server, location所有響應給用戶的MIME類型為text/html將會使用該模塊二、apacheapche可以通過mod_pagespeed http://www.modpagespeed.com/來實現,我的服務器是Ubuntu1、下載mode_pagespeed

wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-beta_current_i386.deb2、安裝dpkg -i mod-pagespeed*執行完畢后會提示重啟3、修改配置文件/etc/apache2/mods-available/pagespeed.conf,下面我著重介紹一下ModPagespeedEnableFilters這個是啟用的過濾器,collapse_whitespace,remove_comments分別為替換空白字符和刪除注釋,其它參數請見mod_pagespeed官網

<IfModule pagespeed_module>    # Turn on mod_pagespeed. To completely disable mod_pagespeed, you    # can set this to "off".    ModPagespeed on    # We want VHosts to inherit global configuration.    # If this is not included, they'll be independent (except for inherently    # global options), at least for backwards compatibility.    ModPagespeedInheritVHostConfig on    # Direct Apache to send all HTML output to the mod_pagespeed    # output handler.    AddOutputFilterByType MOD_PAGESPEED_OUTPUT_FILTER text/html    AddOutputFilterByType MOD_PAGESPEED_OUTPUT_FILTER application/javascript    AddOutputFilterByType MOD_PAGESPEED_OUTPUT_FILTER text/CSS    # If you want mod_pagespeed process XHTML as well, please uncomment this    # line.    #AddOutputFilterByType MOD_PAGESPEED_OUTPUT_FILTER application/xhtml+xml    # The ModPagespeedFileCachePath directory must exist and be writable    # by the apache user (as specified by the User directive).    ModPagespeedFileCachePath            "/var/cache/mod_pagespeed/"    # LogDir is needed to store various logs, including the statistics log    # required for the console.    ModPagespeedLogDir "/var/log/pagespeed"    # The locations of SSL Certificates is distribution-dependent.    ModPagespeedSslCertDirectory "/etc/ssl/certs"        # If you want, you can use one or more memcached servers as the store for    # the mod_pagespeed cache.    # ModPagespeedMemcachedServers localhost:11211    # A portion of the cache can be kept in memory only, to reduce load on disk    # (or memcached) from many small files.    # ModPagespeedCreateSharedMemoryMetadataCache "/var/cache/mod_pagespeed/" 51200    # Override the mod_pagespeed 'rewrite level'. The default level    # "CoreFilters" uses a set of rewrite filters that are generally    # safe for most web pages. Most sites should not need to change    # this value and can instead fine-tune the configuration using the    # ModPagespeedDisableFilters and ModPagespeedEnableFilters    # directives, below. Valid values for ModPagespeedRewriteLevel are    # PassThrough, CoreFilters and TestingCoreFilters.    #    # ModPagespeedRewriteLevel PassThrough    # Explicitly disables specific filters. This is useful in    # conjuction with ModPagespeedRewriteLevel. For instance, if one    # of the filters in the CoreFilters needs to be disabled for a    # site, that filter can be added to    # ModPagespeedDisableFilters. This directive contains a    # comma-separated list of filter names, and can be repeated.    #    #ModPagespeedDisableFilters remove_comments,collapse_whitespace    # Explicitly enables specific filters. This is useful in    # conjuction with ModPagespeedRewriteLevel. For instance, filters    # not included in the CoreFilters may be enabled using this    # directive. This directive contains a comma-separated list of    # filter names, and can be repeated.    #    #ModPagespeedEnableFilters rewrite_Javascript,rewrite_css    ModPagespeedEnableFilters collapse_whitespace,elide_attributes,remove_comments    # Explicitly forbids the enabling of specific filters using either query    # parameters or request headers. This is useful, for example, when we do    # not want the filter to run for performance or security reasons. This    # directive contains a comma-separated list of filter names, and can be    # repeated.    #    # ModPagespeedForbidFilters rewrite_images    # How long mod_pagespeed will wait to return an optimized resource    # (per flush window) on first request before giving up and returning the    # original (unoptimized) resource. After this deadline is exceeded the    # original resource is returned and the optimization is pushed to the    # background to be completed for future requests. Increasing this value will    # increase page latency, but might reduce load time (for instance on a    # bandwidth-constrained link where it's worth waiting for image    # compression to complete). If the value is less than or equal to zero    # mod_pagespeed will wait indefinitely for the rewrite to complete before    # returning.    #    # ModPagespeedRewriteDeadlinePerFlushMs 10    # ModPagespeedDomain    # authorizes rewriting of JS, CSS, and Image files found in this    # domain. By default only resources with the same origin as the    # HTML file are rewritten. For example:    #    #   ModPagespeedDomain cdn.myhost.com    #    # This will allow resources found on http://cdn.myhost.com to be    # rewritten in addition to those in the same domain as the HTML.    #    # Other domain-related directives (like ModPagespeedMapRewriteDomain    # and ModPagespeedMapOriginDomain) can also authorize domains.    #    # Wildcards (* and ?) are allowed in the domain specification. Be    # careful when using them as if you rewrite domains that do not    # send you traffic, then the site receiving the traffic will not    # know how to serve the rewritten content.    # Other defaults (cache sizes and thresholds):    #    # ModPagespeedFileCacheSizeKb          102400    # ModPagespeedFileCacheCleanIntervalMs 3600000    # ModPagespeedLRUCacheKbPerProcess     1024    # ModPagespeedLRUCacheByteLimit        16384    # ModPagespeedCssFlattenMaxBytes       2048    # ModPagespeedCssInlineMaxBytes        2048    # ModPagespeedCssImageInlineMaxBytes   0    # ModPagespeedImageInlineMaxBytes      3072    # ModPagespeedJsInlineMaxBytes         2048    # ModPagespeedCssOutlineMinBytes       3000    # ModPagespeedJsOutlineMinBytes        3000    # ModPagespeedMaxCombinedCssBytes      -1    # ModPagespeedMaxCombinedJsBytes       92160    # Limit the number of inodes in the file cache. Set to 0 for no limit.    # The default value if this paramater is not specified is 0 (no limit).    ModPagespeedFileCacheInodeLimit        500000    # Bound the number of images that can be rewritten at any one time; this    # avoids overloading the CPU.  Set this to 0 to remove the bound.    #    # ModPagespeedImageMaxRewritesAtOnce      8    # You can also customize the number of threads per Apache process    # mod_pagespeed will use to do resource optimization. Plain    # "rewrite threads" are used to do short, latency-sensitive work,    # while "expensive rewrite threads" are used for actual optimization    # work that's more computationally expensive. If you live these unset,    # or use values <= 0 the defaults will be used, which is 1 for both    # values when using non-threaded MPMs (e.g. prefork) and 4 for both    # on threaded MPMs (e.g. worker and event). These settings can only    # be changed globally, and not per virtual host.    #    # ModPagespeedNumRewriteThreads 4    # ModPagespeedNumExpensiveRewriteThreads 4    # Randomly drop rewrites (*) to increase the chance of optimizing    # frequently fetched resources and decrease the chance of optimizing    # infrequently fetched resources. This can reduce CPU load. The default    # value of this parameter is 0 (no drops).  90 means that a resourced    # fetched once has a 10% probability of being optimized while a resource    # that is fetched 50 times has a 99.65% probability of being optimized.    #    # (*) Currently only CSS files and images are randomly dropped.  Images    # within CSS files are not randomly dropped.    #    # ModPagespeedRewriteRandomDropPercentage 90    # Many filters modify the URLs of resources in HTML files. This is typically    # harmless but pages whose Javascript expects to read or modify the original    # URLs may break. The following parameters prevent filters from modifying    # URLs of their respective types.    #    # ModPagespeedjspreserveURLs on    # ModPagespeedImagePreserveURLs on    # ModPagespeedCssPreserveURLs on    # Settings for image optimization:    #    # Lossy image recompression quality (0 to 100, -1 just strips metadata):    # ModPagespeedImageRecompressionQuality 85    #    # Jpeg recompression quality (0 to 100, -1 uses ImageRecompressionQuality):    # ModPagespeedJpegRecompressionQuality -1    # ModPagespeedJpegRecompressionQualityForSmallScreens 70    #    # WebP recompression quality (0 to 100, -1 uses ImageRecompressionQuality):    # ModPagespeedImageWebpRecompressionQuality 80    # ModPagespeedImageWebpRecompressionQualityForSmallScreens 70    #    # Timeout for conversions to WebP format, in    # milliseconds. Negative values mean no timeout is applied. The    # default value is -1:    # ModPagespeedImageWebpTimeoutMs 5000    #    # Percent of original image size below which optimized images are retained:    # ModPagespeedImageLimitOptimizedPercent 100    #    # Percent of original image area below which image resizing will be    # attempted:    # ModPagespeedImageLimitResizeAreaPercent 100    # Settings for inline preview images    #    # Setting this to n restricts preview images to the first n images found on    # the page.  The default of -1 means preview images can appear anywhere on    # the page (if those images appear above the fold).    # ModPagespeedMaxInlinedPreviewImagesIndex -1    # Sets the minimum size in bytes of any image for which a low quality image    # is generated.    # ModPagespeedMinImageSizeLowResolutionBytes 3072    # The maximum URL size is generally limited to about 2k characters    # due to IE: See http://support.microsoft.com/kb/208427/EN-US.    # Apache servers by default impose a further limitation of about    # 250 characters per URL segment (text between slashes).    # mod_pagespeed circumvents this limitation, but if you employ    # proxy servers in your path you may need to re-impose it by    # overriding the setting here.  The default setting is 1024    # characters.    #    # ModPagespeedMaxSegmentLength 250    # Uncomment this if you want to prevent mod_pagespeed from combining files    # (e.g. CSS files) across paths    #    # ModPagespeedCombineAcrossPaths off    # Renaming JavaScript URLs can sometimes break them.  With this    # option enabled, mod_pagespeed uses a simple heuristic to decide    # not to rename JavaScript that it thinks is introspective.    #    # You can uncomment this to let mod_pagespeed rename all JS files.    #    # ModPagespeedAvoidRenamingIntrospectiveJavascript off    # Certain common JavaScript libraries are available from Google, which acts    # as a CDN and allows you to benefit from browser caching if a new visitor    # to your site previously visited another site that makes use of the same    # libraries as you do.  Enable the following filter to turn on this feature.    #    # ModPagespeedEnableFilters canonicalize_javascript_libraries    # The following line configures a library that is recognized by    # canonicalize_javascript_libraries.  This will have no effect unless you    # enable this filter (generally by uncommenting the last line in the    # previous stanza).  The format is:    #    ModPagespeedLibrary bytes md5 canonical_url    # Where bytes and md5 are with respect to the *minified* JS; use    # js_minify --print_size_and_hash to obtain this data.    # Note that we can register multiple hashes for the same canonical url;    # we do this if there are versions available that have already been minified    # with more sophisticated tools.    #    # Additional library configuration can be found in    # pagespeed_libraries.conf included in the distribution.  You should add    # new entries here, though, so that file can be automatically upgraded.    # ModPagespeedLibrary 43 1o978_K0_LNE5_ystNklf http://www.modpagespeed.com/rewrite_javascript.js    # Explicitly tell mod_pagespeed to load some resources from disk.    # This will speed up load time and update frequency.    #    # This should only be used for static resources which do not need    # specific headers set or other processing by Apache.    #    # Both URL and filesystem path should specify directories and    # filesystem path must be absolute (for now).    #    # ModPagespeedLoadFromFile "http://example.com/static/" "/var/www/static/"    # Enables server-side instrumentation and statistics.  If this rewriter is    # enabled, then each rewritten HTML page will have instrumentation javacript    # added that sends latency beacons to /mod_pagespeed_beacon.  These    # statistics can be accessed at /mod_pagespeed_statistics.  You must also    # enable the mod_pagespeed_statistics and mod_pagespeed_beacon handlers    # below.    #    # ModPagespeedEnableFilters add_instrumentation    # The add_instrumentation filter sends a beacon after the page onload    # handler is called. The user might navigate to a new URL before this. If    # you enable the following directive, the beacon is sent as part of an    # onbeforeunload handler, for pages where navigation happens before the    # onload event.    #    # ModPagespeedReportUnloadTime on    # Uncomment the following line so that ModPagespeed will not cache or    # rewrite resources with Vary: in the header, e.g. Vary: User-Agent.    # Note that ModPagespeed always respects Vary: headers on html content.    # ModPagespeedRespectVary on    # Uncomment the following line if you want to disable statistics entirely.    #    # ModPagespeedStatistics off    # This page lets you view statistics about the mod_pagespeed module.    <Location /mod_pagespeed_statistics>        Order allow,deny        # You may insert other "Allow from" lines to add hosts you want to        # allow to look at generated statistics.  Another possibility is        # to comment out the "Order" and "Allow" options from the config        # file, to allow any client that can reach your server to examine        # statistics.  This might be appropriate in an experimental setup or        # if the Apache server is protected by a reverse proxy that will        # filter URLs in some fashion.        Allow from localhost        Allow from 127.0.0.1        SetHandler mod_pagespeed_statistics    </Location>    # Enable logging of mod_pagespeed statistics, needed for the console.    ModPagespeedStatisticsLogging on    <Location /pagespeed_console>        Order allow,deny        Allow from localhost        Allow from 127.0.0.1        SetHandler pagespeed_console    </Location>    # Page /mod_pagespeed_message lets you view the latest messages from    # mod_pagespeed, regardless of log-level in your httpd.conf    # ModPagespeedMessageBufferSize is the maximum number of bytes you would    # like to dump to your /mod_pagespeed_message page at one time,    # its default value is 100k bytes.    # Set it to 0 if you want to disable this feature.    ModPagespeedMessageBufferSize 100000    <Location /mod_pagespeed_message>        Order allow,deny        Allow from localhost        Allow from 127.0.0.1        SetHandler mod_pagespeed_message    </Location></IfModule>

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb
久久精品国产久精国产一老狼| 欧美激情手机在线视频| 日韩小视频网址| 在线精品国产欧美| 午夜精品福利电影| 国产97在线视频| 国产精品一区二区三区毛片淫片| 中文字幕欧美精品在线| 成人免费激情视频| 亚洲电影中文字幕| 欧美福利视频网站| 亚洲欧洲一区二区三区在线观看| 久久成人国产精品| 国产偷亚洲偷欧美偷精品| 色午夜这里只有精品| 三级精品视频久久久久| 福利视频一区二区| 国产日韩精品在线播放| 日韩av网站导航| 欧美日韩激情视频8区| 亚洲成人1234| 91久久久久久久| 成人激情电影一区二区| 国产精品丝袜高跟| 国产精品视频久久久| 日韩国产精品一区| 国产在线不卡精品| 国产一区二区免费| 日韩成人在线免费观看| 亚洲欧美日韩综合| 国内精品久久久久久久久| 亚洲精品日韩av| 国产精品久久久久久久久免费看| 亚洲人成免费电影| 欧美激情免费视频| 欧美人与物videos| 日韩av在线直播| 中文字幕亚洲专区| 国产91在线高潮白浆在线观看| 欧美日韩亚洲视频| 欧美亚洲国产日韩2020| 欧美裸体男粗大视频在线观看| 欧美电影电视剧在线观看| 日韩免费在线看| 亚洲欧洲中文天堂| 国产精品一区二区久久久久| 姬川优奈aav一区二区| 国产精品揄拍一区二区| 国产精品最新在线观看| 成人免费网站在线观看| 日韩大胆人体377p| 伊人久久精品视频| 一区二区三区 在线观看视| 国产97在线|日韩| 中文字幕亚洲欧美日韩2019| 久久五月天综合| 欧美日韩ab片| **欧美日韩vr在线| 精品国内自产拍在线观看| 久久精品亚洲精品| 亚洲精品之草原avav久久| 久久精视频免费在线久久完整在线看| 国产成人精品999| 国产精品第三页| 亚洲精品有码在线| 国产噜噜噜噜噜久久久久久久久| 国产精品自产拍在线观看| 日韩av在线影院| 亚洲欧洲在线播放| 国产精品久久久久一区二区| 91精品国产高清久久久久久| 俺也去精品视频在线观看| 久久国产视频网站| 亚洲最大av在线| 日韩中文在线中文网在线观看| 久久久97精品| 91精品久久久久久久久久另类| 国产亚洲激情在线| 亚洲精品视频在线播放| 日韩中文字幕久久| 国产精品一区二区三区免费视频| 日韩欧美亚洲国产一区| 久久久久久91香蕉国产| 亚洲精品一区中文字幕乱码| 久久久久久久色| 亚洲新声在线观看| 97精品一区二区视频在线观看| 欧美特级www| 国产精品免费久久久| 国产日韩欧美成人| 日韩av影片在线观看| 久久综合久中文字幕青草| 日韩精品在线观看网站| 另类图片亚洲另类| 欧美成人第一页| 欧美日韩国产精品| 欧美亚洲在线视频| 欧美在线xxx| 亚洲人成人99网站| 精品视频在线播放| 亚洲自拍偷拍网址| 国产999精品视频| 国产欧美精品日韩精品| 92看片淫黄大片欧美看国产片| 久久影视电视剧免费网站清宫辞电视| 欧美性生活大片免费观看网址| 日韩毛片中文字幕| 亚洲高清在线观看| 国产精品国产自产拍高清av水多| 日韩视频免费在线观看| 欧美激情精品久久久久久黑人| 97国产真实伦对白精彩视频8| 在线观看久久久久久| 亚洲免费一级电影| 欧美亚洲国产视频小说| 国产精自产拍久久久久久蜜| 91九色精品视频| 91在线无精精品一区二区| 日韩成人黄色av| 亚洲成avwww人| 日韩最新在线视频| 97在线视频一区| 午夜精品一区二区三区在线播放| 国产欧洲精品视频| 欧美日韩精品中文字幕| 成人欧美一区二区三区黑人孕妇| 中文字幕久热精品视频在线| 久99久在线视频| 综合网中文字幕| 精品久久香蕉国产线看观看gif| 国产成+人+综合+亚洲欧美丁香花| 日韩二区三区在线| 国产精品99蜜臀久久不卡二区| 91成人在线视频| 都市激情亚洲色图| 日韩精品在线免费播放| 欧美诱惑福利视频| 欧美孕妇孕交黑巨大网站| 亚洲一区二区国产| 国产啪精品视频| 国产精品视频久久久| 欧美黑人xxx| 国产精品视频免费观看www| 国产精品福利观看| 欧美精品一区二区三区国产精品| 日韩毛片在线观看| 国产精品激情av在线播放| 国产黑人绿帽在线第一区| 91国内在线视频| 欧美激情精品久久久久久蜜臀| 亚洲成人黄色在线观看| 亚洲www永久成人夜色| 91精品久久久久久久久不口人| 成人xvideos免费视频| 欧美亚洲激情视频| 日日狠狠久久偷偷四色综合免费| 国内精品小视频在线观看| 自拍亚洲一区欧美另类| 亚洲欧美三级伦理| 国产成人在线视频| 国产91网红主播在线观看| 亚洲免费视频在线观看| 91在线播放国产| 中文字幕亚洲在线|