-1

I have spend more then three days fixing it and now I have no option but to ask here.

I'm running a VPS on which I'm hosting Wordpress. mysite.com/ has a bootstrap on it but mysite.com/backup/ has wordpress. So when I enter mysite.com/back/wp-admin, I can access it but can't when I do mysite/wp-admin.

Anyway now I'm trying to install a Theme which comes with most of it's xml as xml.gz. During installation, it says it fails to detect GZIP. I can extract the GZIP and use Wordpress Import to get in the XML but ther are tons of it and not all of them really load up properly. I need to let the server do the decompression and make it work.

I've been searching everywhere and enabled GZIP everywhere. I have enabled the GZIP in the

nginx.conf

Aparche

htacess

php.ini

I also increased the PHP memory to 128M.

I followed the guide here

https://rtcamp.com/tutorials/nginx/enable-gzip/

Both gtmetrix.com and http://www.whatsmyip.org/http-compression-test tells me the GZIP is enabled on the server side and on the output page.

Even Wordpress plugin tell me GZIP is enabled.

I checked here

how to check mod_deflate is enabled in apache?

All of them gave me the module is indeed enabled.

www[dot]gidnetwork.com/tools/gzip-test.php

Tells me the GZIP is enabled so does this command

a2enmod deflate

Yet during the Wordpress theme installation, it doesn't see GZIP is enabled on my server to decompress its files.

Community
  • 1
  • 1
devyJava
  • 135
  • 8
  • I reckon you can't use GZIP on VPS because you don't actually have static server space on which to store the gzipped file (my VPS hosting does this so I assume it's all VPS hosting). However, try Autoptimize plugin. It works great and manages to cache assets even on my VPS hosting server. – Nathaniel Flick Jul 06 '15 at 10:23
  • @NathanielFlick GZIP does seem enable using the online tools described. Right now I don't want to use GZIP to speed up the page which AutoOptimize seem to do but rather install a theme which comes in gz format, assuming compressed. – devyJava Jul 06 '15 at 11:33
  • I don't think you'd ever find WP files gzipped on the server but you can serve them to the browser that way. More info here on different ways to do it: http://softstribe.com/wordpress/enable-gzip-compression-in-wordpress – Nathaniel Flick Jul 07 '15 at 02:59
  • @NathanielFlick I've pretty much tried all of them before. They only do decompress compression when the file appears on the output, but I'm not sure if any decompress compression is being done on the server. Even though gtmetrix does say server compression is on. But why isn't the WordPress theme installation seeing it? Will it make a difference if I completely format WordPress install anew or will it make no difference.? – devyJava Jul 07 '15 at 07:10

1 Answers1

0

A single small line of code within the index.php file will do the job. Just add ob_start('ob_gzhandler'); on top of your index.php located in the root directory of your WordPress installation:

<?php
ob_start('ob_gzhandler');
/**
 * Front to the WordPress application. This file doesn't do anything, but loads
 * wp-blog-header.php which does and tells WordPress to load the theme.
 *
 * @package WordPress
 */
[...]

reference : https://codex.wordpress.org/Output_Compression

Harshad Yeola
  • 1,060
  • 9
  • 10
  • I added that snippet into index.php in public_html . Logging back into Wordpress Theme, it's still saying GZIP compression is not enable. Also Wordpress plugin for htaccess gives me different file from the one shown in FileZilla in index_html – devyJava Jul 06 '15 at 11:26
  • can you check you have php compression library installed like `php5-gd` – Harshad Yeola Jul 06 '15 at 12:21
  • on ubuntu you can check that with `dpkg -l | grep php` – Harshad Yeola Jul 06 '15 at 12:22
  • Does it matter on which user I ssh to get that value? I ran that command using ssh root@[VPS IP]. Would it matter if I tried doing it with a different username which might be on it? Do you think Wordpress is looking for a different PHP and not being directed to that root directory where the PHP module is installed? – devyJava Jul 06 '15 at 13:19
  • you know what i can do now? – devyJava Jul 07 '15 at 18:35