Joomla gzip не работает

Gzip сжатие не работает — Joomla 2.5: Общие вопросы

Новости Joomla

WT JoomShopping Bitrix24 PRO — плагин двухсторонней интеграции v.3.0.0

Большое обновление бесплатного плагина двухсторонней интеграции интернет-магазина JoomShopping и CRM Битрикс 24. Плагин передаёт данные клиентов и товаров в CRM, может менять статусы заказа при изменении стадии лида или сделки в CRM. Поддерживает поиск и создание контактов, указание utm-меток. Поддерживает формы обратной связи Radical Form и Nevigen Quick Order.

Вышел релиз безопасности Joomla 4.2.4

Доступна к загрузке Joomla 4.2.4. Это релиз безопасности с исправлением двух уязвимостей для ветки Joomla 4.2.x.

Embed Office плагин встроенного в страницу просмотра офисных форматов.

Если Вам нужно встроить в страницу сайта просмотр PDF, Word, Excel или PowerPoint файлов, то этот плагин для Вас.

    22 Ответов 6645 Просмотров

Snakerator

  • Захожу иногда 136 3 / 0
  • Кто не рискует, тот не пьет.

Gzip сжатие не работает

Сжатие gzip поддержкивается сервером. Настройки PHP для сервера можно увидеть здесь: http://aristotle.timeweb.ru/phpinfo.php
Попробуйте уточнить в поддержке CMS Joomla, какой именно модуль PHP требуется.

konoden

  • Захожу иногда 326 40 / 0
  • Поиск смысла жизни. Выполнено 15%.

Re: Gzip сжатие не работает

Я обычно в .htaccess пишу следующее:

AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/javascript text/css application/x-javascript
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4.0[678] no-gzip
BrowserMatch bMSIE !no-gzip !gzip-only-text/html

mod_gzip_on Yes
mod_gzip_item_include file \.js$
mod_gzip_item_include file \.css$

На серверах хостинга Timeweb работает корректно

Источник

The Joomla! Forum™

Gzip not working for select components.

Gzip not working for select components.

Post by chrisrkeller » Sun Mar 06, 2011 3:23 am

How do I get the following to gzip?

I am using JCH Optimize.

Y slow says the following. Grade F on Compress components with gzip

There are 8 plain text components that should be sent compressed

If anyone can provide any help that would be great.

My website is www.profitworks.ca and I am trying to improve the performance speed.

FYI — I am not a programmer

Re: Gzip not working for select components.

Post by RussW » Sun Mar 06, 2011 11:09 am

Re: Gzip not working for select components.

Post by almooj-craig » Mon Mar 07, 2011 4:50 pm

You need to tell Apache to deflate your files. There are several ways to do it but this is what I use in the httpd.conf file:

First make sure that the deflate module is being loaded.
LoadModule deflate_module modules/mod_deflate.so
If not load it with the other modules then use the following code.

Re: Gzip not working for select components.

Post by chrisrkeller » Thu Mar 10, 2011 2:04 am

Thanks RussW and almooj-craig.

Gzip is enabled.

almooj-craig — when you say LoadModule deflate_module modules/mod_deflate.so is that code I am supposed to be putting into the httpd.conf file?

Also, where do I find my httpd.conf file? Sorry I am new to coding.

Re: Gzip not working for select components.

Post by almooj-craig » Thu Mar 10, 2011 5:31 pm

I would let Apache deflate the file, it should be quicker than PHP. So I would shut off the Global gzip setting and try to let Apache do it. If you can’t get it to work then use the Global gzip.

My guess is that mod_deflate is already being loaded in the http.conf file. Normally it’s located at:
/etc/httpd/conf/httpd.conf
but most likely you will need root access to change it or some hosts use various programs that allow you to modify your virtualhost.

Try using the same method that you used to eliminate the etags to add the deflate code.

Re: Gzip not working for select components.

Post by chrisrkeller » Sat Mar 12, 2011 4:42 am

Adding the deflate code to my htaccess file did not work.

Any other ideas?

Re: Gzip not working for select components.

Post by almooj-craig » Sat Mar 12, 2011 8:26 am

I did a quick search for apache deflate htaccess and it seems that you can put deflate code into a htaccess file. Perhaps the deflate module isn’t loaded in the httpd.conf file.

In the Joomla administration area you can select Help -> System Info and then select the PHP Information link. Then search for deflate. If it’s loaded it will show up in the Configuration apache2handler loaded modules listing.

If it’s not listed and you don’t have access to your httpd.conf file then perhaps you could ask your host to include the module.

Re: Gzip not working for select components.

Post by chrisrkeller » Sat Mar 12, 2011 4:51 pm

I have found the following in my PHP information

steam filter support = zlib.inflate, zlib.deflate

Does that mean it is loaded?

Re: Gzip not working for select components.

Post by almooj-craig » Sat Mar 12, 2011 5:58 pm

If the deflate module was loaded then it would be mod_deflate, so it looks like that module is not loaded on your server.

Try to get your host to load the module. If they won’t do it then you could use RussW’s suggestion and enable gzip in the global configuration and that will gzip the code that Joomla creates.

Then for the static js, css and txt resources you could gzip them and save them in the same place as the originals but use a gz extension. For example you would have my.css and my.css.gz. Then you tell apache to do a mod_rewrite and serve out the gz file if their browser supports gzip.

Re: Gzip not working for select components.

Post by chrisrkeller » Mon Mar 14, 2011 6:30 pm

I am getting my host provider (go daddy) to load the deflate module.

I will then try putting the script in the .htaccess file and see what happens.

Re: Gzip not working for select components.

Post by chrisrkeller » Tue Mar 15, 2011 2:10 pm

Thanks. It appears to have worked. Gzip score is now an A and my score went from 80 to an 87.

Y slow still says though that

«This page has 11 external Javascript scripts. Try combining them into one.»

How do I do this?

Re: Gzip not working for select components.

Post by almooj-craig » Tue Mar 15, 2011 2:41 pm

Re: Gzip not working for select components.

Post by chrisrkeller » Tue Mar 15, 2011 3:14 pm

Re: Gzip not working for select components.

Post by chrisrkeller » Tue Mar 15, 2011 3:25 pm

Also, for some reason now after the gzip my website does not look right in firefox. In firefox it is missing some background images and gradients.

Yet in Chrome and IE it looks fine.

Any ideas why this is? My website is www.profitworks.ca

Re: Gzip not working for select components.

Post by almooj-craig » Wed Mar 16, 2011 8:32 am

I glanced at your css that was created by JCH Optimize and my guess is that Firefox isn’t using the last line of the file. There is some extra white space in that file so you could manually remove the white space and extra line returns and then upload it and see if there was some character that Firefox does not like.

If that does not work I would temporarily disable JCH Optimize and reload the page and see if it renders correctly.

I don’t think it’s a deflate problem.

Re: Gzip not working for select components.

Post by chrisrkeller » Thu Mar 17, 2011 3:06 am

almooj-craig you have been a huge help. I apologize for not knowing some of the basics I am new to all of this.

How do I edit that code?

What file would that be in and how do I access it?

Re: Gzip not working for select components.

Post by almooj-craig » Thu Mar 17, 2011 8:29 am

Just save a copy then edit out all of the white space using a plain text editor then upload the new version to the same place. Clear your cache or refresh your browser and see if Firefox picks up the missing css.

I’m not sure that will solve the problem but it only takes a minute and there is some unwanted white space in that file anyway.

Re: Gzip not working for select components.

Post by chrisrkeller » Fri Mar 18, 2011 2:58 am

I can’t seem to access the file path below you suggested

There is no GZ folder in JCH_Optimize

As you suggested from my host provider. I am using go daddy.

Also, when I click on the link you provided is does show me the code in my browser but I don’t really see any white space?

/**
* Minify a CSS string
*
* @param string $css
*
* @param array $options (currently ignored)
*
* @return string
*/
public static function process($css, $options = array())
<
$obj = new Minify_CSS($options);
return $obj->_process($css);
>

/**
* @var array options
*/
protected $_options = null;

/**
* @var bool Are we «in» a hack?
*
* I.e. are some browsers targetted until the next comment?
*/
protected $_inHack = false;

/**
* Constructor
*
* @param array $options (currently ignored)
*
* @return null
*/
private function __construct($options) <
$this->_options = $options;
>

/**
* Minify a CSS string
*
* @param string $css
*
* @return string
*/
protected function _process($css)
<
$css = str_replace(«\r\n», «\n», $css);

// apply callback to all valid comments (and strip out surrounding ws
$css = preg_replace_callback(‘@\\s*/\\*([\\s\\S]*?)\\*/\\s*@’
,array($this, ‘_commentCB’), $css);

// remove ws around < >and last semicolon in declaration block
$css = preg_replace(‘/\\s* <\\s*/', '<', $css);
$css = preg_replace(‘/;?\\s*>\\s*/’, ‘>’, $css);

// remove ws around urls
$css = preg_replace(‘/
url\\( # url(
\\s*
([^\\)]+?) # 1 = the URL (really just a bunch of non right parenthesis)
\\s*
\\) # )
/x’, ‘url($1)’, $css);

// remove ws between rules and colons
$css = preg_replace(‘/
\\s*
([ <;]) # 1 = beginning of block or rule separator
\\s*
([\\*_]?[\\w\\-]+) # 2 = property (and maybe IE filter)
\\s*
:
\\s*
(\\b|[#\'»]) # 3 = first character of a value
/x’, ‘$1$2:$3’, $css);

// remove ws in selectors
$css = preg_replace_callback(‘/
(?: # non-capture
\\s*
[^

// remove spaces between font families
$css = preg_replace_callback(‘/font-family:([^;>]+)([;>])/’
,array($this, ‘_fontFamilyCB’), $css);

$css = preg_replace(‘/@import\\s+url/’, ‘@import url’, $css);

// replace any ws involving newlines with a single newline
//$css = preg_replace(‘/[ \\t]*\\n+\\s*/’, «\n», $css);

// separate common descendent selectors w/ newlines (to limit line lengths)
//$css = preg_replace(‘/([\\w#\\.\\*]+)\\s+([\\w#\\.\\*]+)

// Use newline after 1st numeric value (to limit line lengths).
/* $css = preg_replace(‘/
((?:padding|margin|border|outline):\\d+(?:px|em)?) # 1 = prop : 1st numeric value
\\s+
/x’
,»$1\n», $css);*/

/**
* Replace what looks like a set of selectors
*
* @param array $m regex matches
*
* @return string
*/
protected function _selectorsCB($m)
<
// remove ws around the combinators
return preg_replace(‘/\\s*([,>+

/**
* Process a comment and return a replacement
*
* @param array $m regex matches
*
* @return string
*/
protected function _commentCB($m)
<
$hasSurroundingWs = (trim($m[0]) !== $m[1]);
$m = $m[1];
// $m is the comment content w/o the surrounding tokens,
// but the return value will replace the entire comment.
if ($m === ‘keep’) <
return ‘/**/’;
>
if ($m === ‘» «‘) <
// component of http://tantek.com/CSS/Examples/midpass.html
return ‘/*» «*/’;
>
if (preg_match(‘@»;\\>\\s*\\>/\\*\\s+@’, $m)) <
// component of http://tantek.com/CSS/Examples/midpass.html
return ‘/*»;>>/* */’;
>
if ($this->_inHack) <
// inversion: feeding only to one browser
if (preg_match(‘@
^/ # comment started like /*/
\\s*
(\\S[\\s\\S]+?) # has at least some non-ws content
\\s*
/\\* # ends like /*/ or /**/
@x’, $m, $n)) <
// end hack mode after this comment, but preserve the hack and comment content
$this->_inHack = false;
return «/*/<$n[1]>/**/»;
>
>
if (substr($m, -1) === ‘\\’) < // comment ends like \*/
// begin hack mode and preserve hack
$this->_inHack = true;
return ‘/*\\*/’;
>
if ($m !== » && $m[0] === ‘/’) < // comment looks like /*/ foo */
// begin hack mode and preserve hack
$this->_inHack = true;
return ‘/*/*/’;
>
if ($this->_inHack) <
// a regular comment ends hack mode but should be preserved
$this->_inHack = false;
return ‘/**/’;
>
// Issue 107: if there’s any surrounding whitespace, it may be important, so
// replace the comment with a single space
return $hasSurroundingWs // remove all other comments
? ‘ ‘
: »;
>

/**
* Process a font-family listing and return a replacement
*
* @param array $m regex matches
*
* @return string
*/
protected function _fontFamilyCB($m)
<
$m[1] = preg_replace(‘/
\\s*
(
«[^»]+» # 1 = family in double qutoes
|\'[^\’]+\’ # or 1 = family in single quotes
|[\\w\\-]+ # or 1 = unquoted family
)
\\s*
/x’, ‘$1’, $m[1]);
return ‘font-family:’ . $m[1] . $m[2];
>
>

Re: Gzip not working for select components.

Post by almooj-craig » Thu Mar 24, 2011 4:36 pm

I don’t use the JCH_Optimize plugin so I didn’t realize that it stores the css or js files in with the other cache files and then you need to load Joomla to unserialize it before it’s send to the browser. Personally I would have just stored a static copy with both .css and .css.gz and let Apache do it’s job and only have Joomla create the static files if they are missing.

Anyway I tried to take a look at the file again to see what the extra white space was but it appears that the 260d846ad870ecd3cfb0f035274e4ac9 file has been removed from your cache and you don’t appear to be running the JCH_Optimize plugin any longer.

Re: Gzip not working for select components.

Post by chrisrkeller » Thu Mar 24, 2011 5:38 pm

Yes I turned it off because I discovered it was giving me minimal speed improvements and was causing a problem with my background images in firefox and IE (not chrome)

Any ideas on how to
— combine external javascripts
— combine style sheets
— put css at top
— put javascript at bottom
— minify css

Without using JCH Optimize?

Re: Gzip not working for select components.

Post by almooj-craig » Thu Mar 24, 2011 6:09 pm

With the plugin shut off the Page Speed is 75 with it running it was 87, so that’s a little bit of a difference.

I don’t use JCH Optimize but I read through the code and it seems pretty good and it has good reviews. If you have a development site I would just play around with the configuration settings and see if you can get it to work correctly.

Otherwise you could rewrite it a little so that it works for your site, or you could write something from scratch.

There are also other Site Performance add ons you could try.
http://extensions.joomla.org/extensions . erformance

Re: Gzip not working for select components.

Post by chrisrkeller » Thu Mar 24, 2011 9:28 pm

I am getting a page load speed right now of 85 vs 88 because I did some writing of Gzip code with some help from another guy.

I have fooled around with JCH alot already and I don’t have the skills to write my own code.

Like you suggested I think I will try another extension. I am thinking I will try JFinalizer

Re: Gzip not working for select components.

Post by chrisrkeller » Thu Mar 24, 2011 9:40 pm

Источник

Читайте также:  Как подключить принтер по wps к роутеру xiaomi
Поделиться с друзьями
КомпСовет
Adblock
detector