Permalinks and Nginx
5 posts by 2 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: May 19, 2014 (RSS)
By gversion - May 11, 2014
Hello,
I am thinking of changing from Apache to Nginx and I was wondering if someone could confirm whether or not the Permalinks add-on will still work.
I am still learning about Nginx but my current understanding is that .htaccess rules are not meant to be used so I am wondering if the re-write rules will still work.
I am assuming cmsBuilder will also work on Nginx, is that right? If anyone has any experience running cmsBuilder on Nginx then I'd be interested to hear how they are finding it.
Thanks,
Greg
By gversion - May 11, 2014
I just thought I'd update this with a link about why Nginx doesn't like .htaccess:
http://wiki.nginx.org/LikeApache-htaccess
Regards,
Greg
By Dave - May 19, 2014
Hi Greg,
If you look at the server headers on our own server you'll see that we're actually using nginx ourselves (it comes with recent versions of Plesk):
http://urivalet.com/?http://www.interactivetools.com/#Report
Server: nginx
I know for Apache you can actually put the rewrite rules in the servers httpd.conf instead of the .htaccess files. See where it says "Context: server config, virtual host, directory, .htaccess" here:
http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritecond
So if nginx has something similar you could do that, and I also see some online tools for turning .htaccess rules into their native nginx equivalents:
http://winginx.com/en/htaccess
But overall you need to weigh the cost of maintaining the system and it's complexity versus ease of use. It's pretty cheap and easy to throw more hardware at a slow website (often much cheaper than your time to optimize/maintain complex optimizations), and if there are performance issues, optimizing for real-world situations is almost always more effective than premature optimizations. CMSB itself loads 50+ PHP files on every pageview, and on my dev pc CMSB scans and parses 500+ plugin files on every load and I still get results in a fraction of a second. Linux and PHP is really good at parsing config files quickly. You can see the response time of our website on the bottom right of every page, and it's usually around 0.10 seconds. So I wouldn't worry about .htaccess files myself (and I don't). Usually the biggest gains are seen by optimizing SQL queries, but you really need to check it on a site by site basis.
Are you running into performance issues now? Or just thinking ahead?
Hope that helps! Let me know any questions.
interactivetools.com
By gversion - May 19, 2014
Hi Dave,
l'm pleased to see that you guys are using Nginx. I'll certainly check out the links you've shared and I'll take on board your comments about balancing effort vs return when optimising the site.
My main concern is that the Permalinks plugin still works when I make the switch from Apache to Nginx, which I guess it will do from your response so that's good news!
I'm just planning for a high traffic website, there are no real performance issues currently ;)
Thanks again,
Greg
By Dave - May 19, 2014
Hi Greg,
I think how Plesk works (which we use) is it uses nginx for some requests and Apache for others, and/or it uses nginx as a reverse proxy for some of the content. So you'll definitely want to experiment. I've heard a lot about people using non-Apache web servers for static content to increase performance and reduce memory/cpu.
All we use the .htaccess for is to tell Apache to redirect the request to cmsAdmin/plugins/permalinks/permalinks_dispatcher.php if it can't find a matching file or dir for the requested URL. So if you can get it to do that you should be fine. But we haven't done any direct testing with any of that.
Cheers,
interactivetools.com