5 ms·
You don't need fast go to serve php through nginx. You can - and probably should - just use nginx as a reverse proxy in front of php-enabled apache. Best of b
by seunosewa 14y ago
You don't need fast go to serve php through nginx. You can - and probably should - just use nginx as a reverse proxy in front of php-enabled apache. Best of both world.
- eropple 14y agoNginx+PHP-FPM blows the doors off of Apache+mod_php. Why "should" you do this?
- jacques_chester 14y agoThere is a particular use case where output buffering worked better on Apache/mod_php, but I believe it's been fixed.
- nnq 14y ago> Best of both worlds How is this best of both worlds?! You add one more layer where things can go wrong, for mostly no benefit nowadays. Now people need to know how to properly configure and secure two pieces of technology that do the same things. I know this is the most popular setup nowadays for new php deployments and this is why I hate it so much! Why does everyone have to complect anything from software to devops nowadays?! If you start with something like this and use the same mindset of "just the best tool for the job, nothing else, not matter how many tools you use" for everything from devops to frameworks to your app you'll end up sooner or later with something that makes asp.net and iis setups or even spring based enterprisey ones look like a breath of fresh air! Better spend some extra effort to make your php app work great on the nginx+php setup. My advice for anybody doing PHP: remember why you are using PHP and not something else in the first place! because you want everything to be drop-dead no-think simple, from devops to framework, to app! because this way you can concentrate 90% of your effort on front-end, design and pr (and it's not necessarily bad if this is how your business should work)!
- FooBarWidget 14y agoI've been using Apache behind Nginx for years, and not once has it gone wrong. HTTP reverse proxying is not something overly complicated that can go wrong often. How it is best of both worlds? Nginx simply does not have all the features Apache have. Take a look at the .htaccess rules that Wordpress and WP-Supercache needs. It's much easier to to run Wordpress on Apache and put that behind Nginx than to figure out how to rewrite the rules to Nginx form (or worse, update the rules when they change). There's also a ton of Apache modules that have no Nginx equivalent, or no easy Nginx equivalent. Why I use PHP? Because some apps don't have good Ruby or Python equivalents. After all these years I still haven't found anything better than Wordpress and phpMyAdmin. If it's my own code, sure, I'll write Ruby, but I'm talking about apps. Putting Nginx before Apache allows it to protect Apache from slow clients because Nginx buffers requests and responses.
- polyfractal 14y agoFWIW, I routinely run WP + W3TotalCache on nginx. Sure, their config files were a little interesting to get setup the first time, but now it's smooth sailing. It's only easier for Apache because the .htaccess files are readily available and ship with the product/plugin. Nginx takes a little googling to get started.