Simply put the cms is installed on a shared/cloud hosting server
FWIW, that statement says two different things. You did do a great debugging thing by checking with a vanilla install.
The only thing you can do is debug Mage_Core_Model_Design_Package::_mergeFiles()
and/or Mage_Core_Helper_Data::mergeFiles()
. I believe the latter of these is where execution is breaking out.
Also, ensure that display_errors
and developer mode are enabled (I would just do this in index.php
temporarily given the environment issues). Also ensure to check error logs in var/log/
. You may want to verify that session & cache files are able to write to the var
directory as well.
Edit:
Before you debug, confirm that the site looks as you would expect with merging disabled.
Since you are using FTP you want to keep debug iterations to a minimum. So, you should use Magento's native logging:
Mage::log(__LINE__,null,'merge.log',true);
You'll want to sprinkle this throughout the methods in question. I'd start with the mergeFiles()
method from the core helper:
public function mergeFiles(array $srcFiles, $targetFile = false, $mustMerge = false,
$beforeMergeCallback = null, $extensionsFilter = array())
{
Mage::log(__METHOD__,null,'merge.log',true); //for some context
try {
// check whether merger is required
$shouldMerge = $mustMerge || !$targetFile;
if (!$shouldMerge) {
Mage::log(__LINE__,null,'merge.log',true);
if (!file_exists($targetFile)) {
$shouldMerge = true;
} else {
$targetMtime = filemtime($targetFile);
foreach ($srcFiles as $file) {
if (!file_exists($file) || @filemtime($file) > $targetMtime) {
$shouldMerge = true;
break;
}
}
}
}
// merge contents into the file
if ($shouldMerge) {
Mage::log(__LINE__,null,'merge.log',true);
if ($targetFile && !is_writeable(dirname($targetFile))) {
// no translation intentionally
throw new Exception(sprintf('Path %s is not writeable.', dirname($targetFile)));
}
// filter by extensions
if ($extensionsFilter) {
if (!is_array($extensionsFilter)) {
$extensionsFilter = array($extensionsFilter);
}
if (!empty($srcFiles)){
foreach ($srcFiles as $key => $file) {
$fileExt = strtolower(pathinfo($file, PATHINFO_EXTENSION));
if (!in_array($fileExt, $extensionsFilter)) {
unset($srcFiles[$key]);
}
}
}
}
if (empty($srcFiles)) {
// no translation intentionally
throw new Exception('No files to compile.');
}
$data = '';
foreach ($srcFiles as $file) {
if (!file_exists($file)) {
continue;
}
$contents = file_get_contents($file) . "\n";
if ($beforeMergeCallback && is_callable($beforeMergeCallback)) {
$contents = call_user_func($beforeMergeCallback, $file, $contents);
}
$data .= $contents;
}
if (!$data) {
// no translation intentionally
throw new Exception(sprintf("No content found in files:\n%s", implode("\n", $srcFiles)));
}
if ($targetFile) {
file_put_contents($targetFile, $data, LOCK_EX);
} else {
return $data; // no need to write to file, just return data
}
}
return true; // no need in merger or merged into file successfully
} catch (Exception $e) {
Mage::logException($e);
}
return false;
}
If you do not see var/log/merge.log
being created, first drop that call in at the very end of index.php
; if you still don't see it then there is something amiss with your environment and you will need your host to help. If you do see it but it contains no content from the helper, then you need to step back to the _mergeFiles()
call in the design package model. Have fun!
Yikes lots of questions here. BTW, feel free to open issues on our github as well to get help. I know lots of folks there use nginx, while I personally have little experience with it.
Do I need to change .host IP to my site public IP and .port to 80 here?
The backend
should point to the IP and host where Magento is running with nginx.
do I also need to uncomment and change the VARNISH_LISTEN_ADDRESS=192.168.1.5 and VARNISH_LISTEN_PORT=6081 to public IP address of my website and port to 80?
Yes, I believe so.
and what about VARNISH_ADMIN_LISTEN_ADDRESS=127.0.0.1 and VARNISH_ADMIN_LISTEN_PORT=6082 also just to make you aware I did configure DAEMON_OPTS= options according to as described in section 2 of https://github.com/nexcess/magento-turpentine/wiki/Installation
This will depend on how you're setting things up in your environment. These should be accessible to Turpentine, so that it can communicate with Varnish to do things like apply VCL changes and ban/purge items from the cache.
Admin > System > Cache Management: is this fine or do I need to make any change here?
We recommend that people turn off all other caches, and leave on the two Varnish related caches. Once things are working you can tweak these settings.
Admin > System > Configuration > Varnish Options > Servers : need to make any change here? i think I need to enter Varnish Authentication Key from /etc/varnish/secret file?
Yes, unless you've set up Varnish to not use a key.
Also, Config File Location & Custom VCL File Location are not there where path is defined. Will these be generated when I press Admin > System > Cache Management > Varnish Management > Apply Varnish Config.
No, when you click 'Apply Varnish Config' Turpentine will generate a VCL file and attempt to load it into the running Varnish instance. It will also save the generated VCL file in the location you specify under Config File Location
- which may not matter if your Varnish is not set up to read that file when starting up. Custom VCL File Location
is a way to add custom VCL code to the generated VCL file.
finally what to do with Admin > System > Configuration > Caching Options > Backend
This is where you tell Turpentine how to communicate with the Varnish admin interface (IP, port) so it can apply VCL, ban/purge content etc.
You may find our wiki configuration page helpful when setting things up.
Best Answer
Go to Admin panel -> Configuration -> Full Page Cache -> Varnish Configuration: Use following settings:
Hope this will help...