Does anyone have nginx and SEF working correctly?

Started by uniqbuy, February 21, 2015, 23:33:52 PM

Previous topic - Next topic

uniqbuy

I have just set up a VPS with Centos 6.6 + PHP 5.6.5 + MySQL 5.6.22 + Nginx 1.6.2 + Joomla 3.3.6 + Reviver theme (from themeforest).

I am not sure if I am allowed to post the URL but will do if it is not a breach of any rules.

With SEF disabled everything works perfectly. With SEF enabled, 3 things break: remove from cart (using the cart module), quick view and states dropdown from this page ...en/my-account/edit.html

I can probably work around the quick view and cart module issues by just disabling the quick view and removing the cart module javascript. But, the states dropdown is critical so if anyone has got this working would love to hear about it.

GJC Web Design

I wonder if this is a nginx issue?

Have you tried with the base template (Protostar) and SEF on?

the state dropdown is because the ajax sent to retrieve the state list is
http://www.ubvps.co.uk/en/my-account/index.php?option=com_virtuemart&view=state&format=json&virtuemart_country_id=13

it should be

http://www.ubvps.co.uk/en/index.php?option=com_virtuemart&view=state&format=json&virtuemart_country_id=13

are you going to be using multi-lingual? If not get rid of all the other languages

r u using a 3rd party sef or lang component

I know this template and my take is the quickstart is probably the worst way to get it up and running - if you must use it install JUST the template on a clean Joomla/VM install
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

uniqbuy

Hi John

Thanks for replying. Definitely an NGINX + VM issue. Joomla is properly configured to work with NGINX but VM doesn't seem to be and hasn't been for some time it seems from a quick search of this forum. Using stock SEF, no 3rd party components. I have played about with cgi.fix_pathinfo in php.ini but no difference. I have also tried PHP-FPM instead of FCGI and also no difference.

It is just a development site at the moment and easiest to just throw it on with quickstart. I have always just used the quickstart and then removed what was not necessary rather than clean install and never really been an issue. I have switched off currencies and a bunch of other stuff I will not use. I have also turned off JSS/CSS compression for testing purposes.

I agree the Reviver template is loaded with way more junk than needed but the module positions are all in the right places and looks ok - it is not written the best and could have way less code to achieve the same effect but I can't really afford to have a custom design.

I have tried this fix: http://forum.virtuemart.net/index.php?topic=125965.0 but have noticed that it cannot work because the ajax sent has my-account in it.

Any ideas on a workaround?


GJC Web Design

Sorry, can't help you with the nginx .. I leave server stuff to server people..  ;)

But to get in your case the State lookup working just hardcode the url - it will never change once you set up the live site

i.e. 
$.getJSON('http://www.ubvps.co.uk/index.php?option=com_virtuemart&view=state&format=json&virtuemart_country_id=' + byAjax,
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

uniqbuy

Thanks John

Tried and failed. However, I have noticed that on the registration through the checkout process http://www.ubvps.co.uk/checkout/cart.html the dropdown works. So I think I just need to copy the code across from that page to the registration page outside of checkout. However, what do you use to identify the js in use on the dropdowns and the requests being made? I can't get Firebug on my version of Firefox.

Alternatively, I suppose I could just get rid of allowing registration outside of checkout but it would be less than ideal.

GJC Web Design

Hmm - don't see why it wouldn't work  - what do u see when u paste http://www.ubvps.co.uk/index.php?option=com_virtuemart&view=state&format=json&virtuemart_country_id=13  in a browser

like so much with that template the std. VM JS is over written in http://www.ubvps.co.uk/templates/t3_blank/js/vmprices2.js

do the change on line 312

$.getJSON('http://www.ubvps.co.uk/index.php?option=com_virtuemart&view=state&format=json&virtuemart_country_id='; + byAjax,

I just use Firebug
               

GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

bunglehaze

Just as a note, I am currently using Reviver and cannot wait to get a different template on. Your issues may be getting amplified by the template as I have found tons of problems with it. One such issue is the adding of the cart URL to the end of whatever category I am in at the time, I am fairly sure it didn't do this before I used Reviver.

Also things like the AJAX reload on prices doesn't seem to work at all. All in all I would say although it looks nice i would consider looking at a different template (at least to try and figure your issues first)

uniqbuy

To be fair the template has done the job for me for a few years now. I did hack it a bit and GJC did some amendments to the stupid discounts display system that was originally used (probably still is - not updated my live site for ages as it would require more custom work and not really needed yet).

Other than that the only real problem is that the template is very heavy - loads way too much code which is probably unnecessary and could do with being much simpler. Those pretty effects have no real useful purpose that customers care about. I have got rid of most of the plugins and modules in the template and made it as simple as I could. But, Apache is nowhere near as good as Nginx for my purposes so really want to get this to work. Even if it does mean disabling the funky cart business and quick view. In the end I may just get rid of the registration page outside of the checkout process as well but would rather not.

I think I will have another play around at the weekend.

GJC Web Design

but did u try?

Quotelike so much with that template the std. VM JS is over written in http://www.ubvps.co.uk/templates/t3_blank/js/vmprices2.js

do the change on line 312

$.getJSON('http://www.ubvps.co.uk/index.php?option=com_virtuemart&view=state&format=json&virtuemart_country_id='; + byAjax,

the template doesn't use the std vmprices.js - it uses it's own vmprices2.js
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

uniqbuy

Not had a chance yet. Was going to give it a go today after work but found out my security certificate had expired and needed to renew. Then found out that for some unknown reason the homepage to my website is showing "this site may be hacked" in Google results. Think it is a false positive and only on the homepage but not great.

Milbo

Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

uniqbuy

Thanks Milbo but it is a bit of a strange one this. It is only a problem with Nginx and search engine friendly URLs.

Apache + SEF - fine
Nginx + no SEF - fine
Nginx + SEF - partial functionality

What makes it worse is that it seems to work ok on my developers set-up which is also using Nginx: http://velikorodnov.com/dev/reviver3/index.php/en/

I have tried to downgrade the Nginx version but that hasn't done anything. I haven't tried to downgrade the PHP version to 4.4.33 which is what my developers site is using as it would be an absolute pain to build the php and related components from source and I cannot find any repos that has that old version.

There seems to be a difference in the way Apache sends URL information to JQuery etc. and the way Nginx does it. Or it could just be the PHP version.

That said Nginx + SEF problems seem to be a common issue:
http://forum.virtuemart.net/index.php?topic=125965.msg431491#msg431491
http://forum.virtuemart.net/index.php?topic=108176.0
http://forum.virtuemart.net/index.php?topic=117896.0

I really do like VM and have been using it a while but may now have to give DrupalCommerce or Magento a look to see how they perform in comparison.

Milbo

php 4 wont work and it is definitly your setup, there are some stores running with nginx.

and please follow the main rule before reporting a bug .....

.... use the default template and NOT something else. We are sick to discuss 3rd party extensions problems. So many people in this thread tell you, and it seems you just ignore it.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

uniqbuy

Sorry, I do appreciate that Milbo in respect of the quick view and the cart which are 3rd party extensions to make the site look nice. I do also appreciate that Nginx is not used as commonly as Apache so if there were problems fewer people would know about them. Maybe you could try this edit page with SEF turned on for the demo and see if it throws up the same problem.

Using Protostar template the county dropdown still does not work: http://www.ubvps.co.uk/index.php/en/my-account/edit

This is the code I am using for SEF:

location / {
     expires 1d;

     # Enable joomla SEF URL's inside Nginx
     try_files $uri $uri/ /index.php?$args;
  }

That said the template designer has just sent me his Nginx config and PHP.ini files and I am going to compare them to see if they are different to mine in any meaningful way.

uniqbuy

Sorry, I meant my developers site is running PHP 5.4.33 whereas I am using the latest version - not sure if this is what is causing the issue but it could be.

I have tried to copy the developers settings but no change. I have attached my Nginx.conf file maybe someone can see an issue in it that I cannot.