1

所以页面加载缓慢......想要根据pingdom下载4.4MB的页面。我尝试使用磁盘缓存,但将配置添加到 httpd.conf 时 spiceworks 无法启动

httpd.conf:

ServerRoot "C:/Program Files/Spiceworks/httpd"
ServerTokens Min

Listen 9002
TraceEnable off
UseCanonicalPhysicalPort On
AllowEncodedSlashes On
EnableSendfile Off
EnableMMAP Off

ThreadsPerChild 150
Win32DisableAcceptEx


PidFile "log/httpd.pid"

LoadModule log_config_module modules/mod_log_config.so
LoadModule log_rotate_module modules/mod_log_rotate.so
LoadModule mime_module modules/mod_mime.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule alias_module modules/mod_alias.so
LoadModule cache_module modules/mod_cache.so
LoadModule mem_cache_module modules/mod_mem_cache.so
LoadModule expires_module modules/mod_expires.so
LoadModule ssl_module modules/mod_ssl.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_scgi_module modules/mod_proxy_scgi.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule headers_module modules/mod_headers.so
LoadModule disk_cache_module modules/mod_disk_cache.so

# uncomment the following to enable compression from server to client
# depending on your network, this may increase performance
#LoadModule deflate_module modules/mod_deflate.so

# for debugging
#LoadModule dumpio_module modules/mod_dumpio.so

# Restrictive default access configuration
<Directory />
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>

# No directory overrides are allowed in the rest of this config, but should
# someone customize it, don't allow download of the config files
<FilesMatch "^\.ht">
    Order allow,deny
    Deny from all
    Satisfy All
</FilesMatch>

# server logging
# values: debug, info, notice, warn, error, crit, alert, emerg.
LogLevel warn
ErrorLog "log/error.log"

<IfModule dumpio_module>
  # Full request logging
  # Also change LogLevel above
  DumpIOInput On
  DumpIOLogLevel debug
</IfModule>

<IfModule log_config_module>
    # CustomLog formats
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common

    # Use combined logging by default
    CustomLog "log/access.log" combined
</IfModule>

<IfModule log_rotate_module>
    RotateLogs On
    RotateLogsLocalTime On
    RotateInterval 86400
</IfModule>

# for debugging rewrites
#RewriteLog "log/rewrite.log"
#RewriteLogLevel 5

# If not specified or undetermined by mime_module
DefaultType text/plain

<IfModule mime_module>
    TypesConfig conf/mime.types
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
</IfModule>

<IfModule deflate_module>
    AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/javascript application/x-javascript text/css
</IfModule>

<IfModule mem_cache_module>
    CacheEnable mem /
    CacheIgnoreHeaders Set-Cookie
    MCacheSize 50000
    MCacheMaxObjectCount 1009
    MCacheMinObjectSize 1
</IfModule>


# client-side caching for assets
<IfModule expires_module>
    ExpiresActive On
    # 10 minutes by default
    <FilesMatch "(i?)\.(ico|gif|jpe?g|png|html|css(\.gz)?|js(\.gz)?)$">
        ExpiresDefault "access plus 10 minutes"
    </FilesMatch>
    # 1 year for assets with cache-buster ("labeled" using location prefix in rewrite rules below)
    <Location "/.asset/">
        ExpiresDefault "access plus 1 year"
    </Location>
</IfModule>

# error documents
ErrorDocument 404 /404.html
ErrorDocument 500 /500.html
ErrorDocument 503 /503.html
ErrorDocument 502 /500.html
ErrorDocument 504 /503.html
ProxyErrorOverride Off

<IfModule proxy_scgi_module>
    Include conf/scgi_proxy.conf
</IfModule>


Alias /.asset "C:/Program Files/Spiceworks/pkg/gems/spiceworks_public-7.5.00065"



<Proxy http://static.spiceworks.com >
    ProxySet retry=0 max=4 smax=1 ttl=15 connectiontimeout=10 acquire=30000 timeout=30
</Proxy>
<Proxy http://community.spiceworks.com >
    ProxySet retry=0 max=4 smax=1 ttl=15 connectiontimeout=10 acquire=30000 timeout=30
</Proxy>


DocumentRoot "C:/Program Files/Spiceworks/pkg/gems/spiceworks_public-7.5.00065"
<Directory "C:/Program Files/Spiceworks/pkg/gems/spiceworks_public-7.5.00065">

    Options FollowSymLinks ExecCGI
    AllowOverride None
    Order allow,deny
    Allow from all

    RewriteEngine On

    <IfModule expires_module>
        # find assets with cache-buster (e.g. "filename?123456")
        # label with location ".asset" and pass through (PT) block above to blow out the client-side expires time
        RewriteCond %{REQUEST_FILENAME} -f                                     
        RewriteCond %{REQUEST_URI} \.(ico|gif|jpe?g|png|html|css|js)$ [NC]     
        RewriteCond %{QUERY_STRING} ^[0-9]+$                                   
        RewriteRule . .asset%{REQUEST_URI}?asset [QSA,NS,PT]                   
    </IfModule>

    
    # proxy to community server to pull in community content
    RewriteRule ^content_points/cdn/(.*) http://static.spiceworks.com/$1 [QSA,NS,L,P]
    RewriteRule ^content_points/pass/(.*) http://community.spiceworks.com/$1?app_render=true&product_version=7.5.00065 [QSA,NS,L,P]
    RewriteRule ^content_points/([^/]+) http://community.spiceworks.com/app/deliveries/$1?product_version=7.5.00065 [QSA,NS,L,P]
    

    # tray opens up to /splash or /first_splash
    # this is just a static file
    RewriteRule ^(first_splash|splash)$ splash.html [NS,L]
    

    # redirect non files to rails
#    RewriteRule ^([^.]+)$ $1.html [QSA]
    RewriteCond %{REQUEST_FILENAME} !-f
    
    <IfModule proxy_scgi_module>
      RewriteRule .? .scgi%{REQUEST_URI} [E=X_HTTP_AUTHORIZATION:%{HTTP:Authorization},QSA,NS,L]
    </IfModule>

    <IfModule headers_module>
        Header set X-UA-Compatible "IE=Edge,chrome=1"
    </IfModule>
</Directory>



# this section is included only when you run httpdconf with the files
# ssl-cert.pem and ssl-private-key.pem in the ssl subdirectory
<IfModule ssl_module>
    Listen 9003
    SSLCompression off

我想补充的是:

<IfModule cache_module>
LoadModule cache_disk_module modules/mod_cache_disk.so
<IfModule cache_disk_module>
CacheDefaultExpire 3600
CacheEnable disk /
CacheRoot "/cache/"
CacheDirLevels 2
CacheDirLength 1
</IfModule>
</IfModule>

我究竟做错了什么?

4

1 回答 1

0

加载时间是多久?还有更多信息吗?

比如,它在哪里加载很长时间?TTFB( http://www.bytecheck.com/)等有多大。

于 2016-03-22T14:09:38.137 回答