N
N
Nikita Gusakov2013-01-30 08:36:11
PHP
Nikita Gusakov, 2013-01-30 08:36:11

Local server takes a long time to give files

Yesterday I installed php 5.4 on my computer, Apache did not touch it, except for changing the name of .htaccess to settings.htaccess
tried to switch to the preinstalled 5.3 - the same garbage,

htaccess content
<IfModule mod_rewrite.c>
  RewriteEngine on 
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?router=$1 [L,QSA]
</IfModule>

Options -Indexes
php_flag magic_quotes_gpc Off
ServerSignature Off
AddDefaultCharset UTF-8

# JavaScript
#   Normalize to standard type (it's sniffed in IE anyways)
#   tools.ietf.org/html/rfc4329#section-7.2
AddType text/javascript                js jsonp
AddType text/json                      json
# Stylesheets
AddType text/css				               css
# Audio
AddType audio/mp4                      m4a f4a f4b
AddType audio/ogg                      oga ogg

# Video
AddType video/mp4                      mp4 m4v f4v f4p
AddType video/ogg                      ogv
AddType video/webm                     webm
AddType video/x-flv                    flv

# SVG
AddType     image/svg+xml              svg svgz
AddEncoding gzip                       svgz

# Webfonts
AddType application/vnd.ms-fontobject  eot
AddType application/x-font-ttf         ttf ttc
AddType application/x-font-woff        woff
AddType font/opentype                  otf

# Assorted types
AddType application/octet-stream            safariextz
AddType application/x-chrome-extension      crx
AddType application/x-opera-extension       oex
AddType application/x-shockwave-flash       swf
AddType application/x-web-app-manifest+json webapp
AddType application/x-xpinstall             xpi
AddType application/xml                     rss atom xml rdf
AddType image/webp                          webp
AddType image/x-icon                        ico
AddType text/cache-manifest                 appcache manifest
AddType text/vtt                            vtt
AddType text/x-component                    htc
AddType text/x-vcard                        vcf

<FilesMatch "(\.(bak|config|dist|fla|inc|ini|log|psd|sh|sql|swp|htaccess)|~)$">
  Order allow,deny
  Deny from all
  Satisfy All
</FilesMatch>

<IfModule mod_gzip.c>
    mod_gzip_on         Yes
    mod_gzip_dechunk    Yes
    mod_gzip_item_include file		\.(html?|txt|css|js|php|pl)$
    mod_gzip_item_include mime		^text\.*
    mod_gzip_item_include mime		^application/x-javascript.*
    mod_gzip_item_exclude mime		^image\.*
    mod_gzip_item_exclude rspheader	^Content-Encoding:.*gzip.*
</IfModule>

<ifModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/css text/javascript application/javascript application/x-javascript
</ifModule>

<ifModule mod_headers.c>
    #кэшировать html и htm файлы на один день
    <FilesMatch "\.(html|htm)$">
        Header set Cache-Control "max-age=43200"
    </FilesMatch>
    #кэшировать css, javascript и текстовые файлы на одну неделю
    <FilesMatch "\.(js|css|txt)$">
        Header set Cache-Control "max-age=604800"
    </FilesMatch>
    #кэшировать флэш и изображения на месяц
    <FilesMatch "\.(flv|swf|ico|gif|jpg|jpeg|png|pdf)$">
        Header set Cache-Control "max-age=2592000"
    </FilesMatch>
    #отключить кэширование
    <FilesMatch "\.(pl|php|cgi|spl|scgi|fcgi)$">
        Header unset Cache-Control
    </FilesMatch>
</IfModule>

<ifModule mod_expires.c>
    ExpiresActive On
    #по умолчанию кеш в 5 секунд
    ExpiresDefault "access plus 5 seconds"
    #кэшировать флэш и изображения на месяц
    ExpiresByType image/x-icon "access plus 2592000 seconds"
    ExpiresByType image/jpeg "access plus 2592000 seconds"
    ExpiresByType image/png "access plus 2592000 seconds"
    ExpiresByType image/gif "access plus 2592000 seconds"
    ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds"
    #кэшировать css, javascript и текстовые файлы на одну неделю
    ExpiresByType text/css "access plus 604800 seconds"
    ExpiresByType text/javascript "access plus 604800 seconds"
    ExpiresByType application/javascript "access plus 604800 seconds"
    ExpiresByType application/x-javascript "access plus 604800 seconds"
    #кэшировать html и htm файлы на один день
    ExpiresByType text/html "access plus 43200 seconds"
    #кэшировать xml файлы на десять минут
    ExpiresByType application/xhtml+xml "access plus 600 seconds"
</ifModule>
ErrorDocument 403 /403.html


This is what loading looks like when everything is bad


And that's how it is when everything is fine

Answer the question

In order to leave comments, you need to log in

6 answer(s)
S
Sergey, 2013-01-30
@Ualde

This is static, why not give static through nginx?

R
rustler2000, 2013-01-30
@rustler2000

subvillion - judging by the pictures, waiting is big there - the server is checking the cache at this time

S
subvillion, 2013-01-30
@subvillion

I don't like caching. Disable it completely, for development it is more harm than good.

S
subvillion, 2013-01-30
@subvillion

missed

V
VBKesha, 2013-02-01
@VBKesha

HostnameLookups in Apache is not included by chance?

A
AdamZ, 2013-06-16
@AdamZ

I have the same problem now and spent a day trying to solve it. A number of static files are given very slowly. Disabling/enabling nginx did not help.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question