Closed (fixed)
Project:
Documentation
Component:
Correction/Clarification
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
22 Jul 2011 at 14:19 UTC
Updated:
17 Jun 2013 at 08:34 UTC
Jump to comment: Most recent
Comments
Comment #1
skolesnyk commentedI'm all in favor of supporting Nginx as a webserver for Drupal. And specifically not as a static content proxy in front of Apache but regular webserver via fast-cgi interface with php-fpm for PHP processing.
It works much faster and requires less resources then Apache-PHP combo.
Not so recent Nginx for Drupal conf files are here https://github.com/yhager/nginx_drupal/tree/master/conf
Also here https://github.com/omega8cc/nginx-for-drupal/tree/master/standalone it's promised that another conf will be available this very summer.
Comment #2
bibo commentedNginx is already used on a lot of Drupal sites (definitely more than Drupal + IIS!), so it's a bit weird it's not even mentioned on the requirements-page (excluding comments).
I'm not too familiar with nginx yet, but I'll be following this issue.
Comment #3
webchickYeah, if someone has familiarity with this and wants to take it on, I think we'd gladly welcome documentation improvements to tell folks how to use Nginx with Drupal.
Comment #4
zserno commentedHint: the fine folks over at the MNPP project (Mac + Nginx + Percona + PHP, a high performance webserver) already created a basic nginx config file for Drupal. See: https://github.com/jyr/MNPP/blob/master/conf/nginx/common/drupal
I've tested it and works fine with Drupal 6 and 7 so this could be a good starting point for this awesome issue.
Comment #5
thamasThere is a wiki page at nginx.org dedicated to Drupal. It can be useful too: http://wiki.nginx.org/Drupal
Comment #6
perusio commentedThat config is hardly a nginx style config. It uses a lot of vices from mod_rewrite. For example, in Drupal 7 there's no need for any rewrite. Not even in Drupal 6 unless you rely on custom_url_rewrite_outbound, like OpenAtrium and ManagingNews do. Also it exists a Nginx group at g.d.o. It already has some history and is neighboring 390 members.
Comment #7
thamasThanks for commenting and mentioning the nginx group, here is the link: http://groups.drupal.org/nginx :o)
Comment #8
perusio commentedDrupal doesn't use
PATH_INFO. Furthermore by making use of it you could be exposing yourself to the infamouscgi.fix_pathinfovuln if your forget to set to 0.Comment #9
thamasNGINX–Drupal project at github: https://github.com/yhager/nginx_drupal (link via Denes.Szabo)
Comment #10
Coornail commentedI think that the next step is to gather what the example config file should provide:
Thoughts?
Comment #11
perusio commentedI'll throw my config on the ring (the docs need updating) and let the "market" sort out while having the freedom to choose: https://github.com/perusio/drupal-with-nginx ;)
Comment #12
EDanee commentedHi guys,
thamas mentioned this topic to me.
I current use nginx - not as a proxy - with php to serve a few (~80) domains, many of them are drupal based.
Due to the increased resource needs we have to upgrade our server, and I also took a closer look on the nginx configuration.
I think perusio's setup is a pretty good setup. I serves as a basis for my final settings as well.
You can find it here:
https://github.com/perusio/drupal-with-nginx
Daniel
Comment #13
Fidelix commentedI use perusio's setup too.
There are some things I'd change (like better organization of included configuration files), and some things I'd remove, at least for a more general nginx setup instead of a high performance (like perusio's repository)
But it's definitely the best start if comparing to other drupal setups out there.
Comment #14
JamesAn commentedI'll toss myself in here too. I've been running nginx + FastCGI for Drupal for almost 2 years now, before nginx made it to a 1.0 release this April and before Drupal 7. After moving from Apache config files to the nginx syntax, I haven't had any issues deploying Drupal websites running on nginx.
The config file set up I use needs some serious updating. I'll try to scrounge some time to give my opinion on some of the sample config files floated around here.
Comment #15
shp commentedSubscribing... Must-have feature!
Comment #16
fuzzy76 commentedAfter trying out Perusios setup I really see the difficulty of this setup. If you don't have the same version of NGINX, you are in for a lot of pain. Error messages all over the places for unsupported configuration directives, and just commenting them out is not enough, as it breaks a lot of functionality. I'm not trying to belittle Perusios work, he has done a great job, I think it might just be a sign that the configuration syntax for NGINX isn't quite mature enough, unless we aim for a minimum version far above 1 (which isn't available in the most common server distro releases yet (Ubuntu 10.04 LTS being a good example).
Comment #17
Fidelix commentedfuzzy76, you are wrong.
Commenting perusio's config directives does not break functionality that is present on the old versions of nginx, except maybe for the limit_conn directive, that can help mitigate DOS attacks. Its syntax has changed since 0.8.
Saying nginx's configuration syntax is not mature because you tried perusio's config and it didn't work right away is lazy and wrong.
Try getting an advanced and customized apache configuration and pasting on a fresh apache installation, and you'll see what's not mature, you'll see what's non-standardized syntax.
Perusio's setup is tuned for his needs, and for overall high performance requirements, and it assumes you are not a newbie that doesn't know how to compile nginx from source.
Thus, his configuration, which is not for newbies that only know how to use vanilla apache, is far from adequate for a general-use config, even more far from being adequate as an official config.
A configuration that's supposed to be general/official would work across all versions of nginx, would have a lot less files, a lot less directives. And that is achievable with nginx's syntax.
The thing is, perusio's config doesn't deal only with what apache's .htaccess deal. It deals with a LOOOOT more stuff like php-fpm pools/instances, load-balancing, bit-streaming for video/audio, reverse-proxy caching (almost like varnish) with Microcache, security considerations, filtering of bad bots/bad requests, crack-attack mitigation, and a LOT more stuff that drupal's standard .htaccess doesn't deal with. So yeah, it's not for the average cpanel/apache user trying to get a little speed boost.
Don't blame nginx's configuration syntax for that.
Comment #18
perusio commentedIn fact you're wrong, completely wrong. It's not related to my config, but rather to Nginx config language. In fact is IMHO lightyears ahead of Apache:
Now my config is not a minimal config. It tries to provide as much as possible of the features that Nginx offers.
If you're investing time in Nginx then why not take advantage of the many things it has to offer?
The fact is that most people never bother with the intricacies of Apache, because there are several layers of indirection provided by the out-of-the-box config. The price you pay is that now you're in sort of a blackbox.
Comment #19
xtfer commentedHaving tried both Perusio's work and the config provided on the Nginx wiki, I can say that, unless you know what you are doing, the later is far easier, and I usually recommend people use that. That goes doubly so if you are not on the latest version of Nginx.
Its not particularly relevant why that is the case. If we want provide "support" for Nginx, arguably we should support the minimum configuration. The question is somewhat moot, however, as support for Nginx is not the same as Apache, where a file can be provided in the install and it just "works".
So what does "support" actually mean?
Comment #20
perusio commentedYou shouldn't recommend a config that doesn't constrain PHP execution. That config is broken in several places.
See: http://wiki.nginx.org/Pitfalls#Passing_Uncontrolled_Requests_to_PHP and http://groups.drupal.org/node/232023#comment-771848
Support yes, but taking all aspects in consideration.
Comment #21
xtfer commented@perusio, Like I said, somewhat beside the point. There must be some middle ground somewhere, a minimum safe configuration, but it's largely irrelevant what that configuration is, as Drupal cannot provide it.
Unless we dump a .conf file in a directory somewhere and tell people to delete it once they've copied it to their nginx configuration, I can't see a way to "support" nginx in any useful way.
But, while we are on the subject, if the configuration is not safe, what is required to make it safe. In other words, what is a minimal safe configuration?
Comment #22
perusio commentedYou could create a drush command/module that checks your current Drupal setup and suggests a config. Checking the setup on the Nginx side is not easy because there's no server side API to get information about it, like in Apache. Minimal:
Possible addons: cron.php and web based updates support.
Comment #23
jhodgdonThis is no longer a Documentation issue.
Comment #24
Fidelix commentedInstead of providing drush stuff, there could, maybe, be an official, community-supported configuration, for general-use.
So this would be documentation indeed.
Comment #25
chx commentedBased on postgresql experience if people want this to be officially supported IMO we need about 5-6 people who would pledge to test and bugfix D7 and D8 with nginx for the next about five years. Aside from that, of course, please write handbook pages and provide example configs.
I see no reason why D8 wouldnt work out of the box as long as fastcgi_param REQUEST_URI $request_uri is passed. But it's not a focus for any of us, so we need people who do focus on this.
Comment #26
perusio commented@chx You can count on me. And I think that we'll find the remaining testers at the Nginx group easily.
Comment #27
RedRat commentedI'm using Drupal 6 and 7 with Nginx for more than a year and can test supposed configurations on my servers.
Comment #28
Andre-B@chx I pledge to test nginx configurations in a high load environment. I can write documentation for this as well.
Comment #29
Fidelix commentedI pledge as well.
Comment #30
Anonymous (not verified) commentedI can also commit to testing and bugfixing for Nginx. I've used Nginx for a little over a year and deploy it on the high availability hosting platforms that I provide.
Comment #31
xtfer commentedI run a couple of nginx servers, and can test.
Comment #32
jhodgdonI'm changing the component of this issue because it really isn't a documentation issue at all.
Actually, I'm not even sure what "support Nginx" means... Maybe someone who is familiar with what it would entail could click "Edit" at the top of this page and create a standard issue summary that outlines what it would mean -- what changes would need to be made to Drupal to support Nginx, what additional files would need to be added to the distribution, etc.? If it's just a matter of saying "we support Nginx", that's one thing, or saying "we have tested Drupal on Nginx and everything works", that's another thing, or "we provide the files and instructions needed to run Nginx on Drupal", that's yet another thing.
Thanks!
Comment #33
mitchell commentedI use Nginx and got started on this. Here's what I did to start this off:
I agree that adding info on configuring Nginx would be very helpful and pertinent to this task. http://groups.drupal.org/nginx probably has some good info, and this is the guide I normally use: Installing Nginx With PHP-FPM And MySQL Support On Ubuntu 12.04 LTS.
After we get the language of these docs together, I suppose we could then add a follow up issue for updating INSTALL.txt. I think these two tasks cover 99.9% of what Nginx users/potential users are looking for. The other .1% is in case 'support for', in this context, wasn't intended to mean 'that Drupal works on'.
Comment #34
jhodgdonI don't think that INSTALL.txt needs to be updated -- it currently says:
And then it says to check the system requirements page for more information. That is probably good enough... we also don't mention IIS in install.txt (although it's on the Requirements page). If you do think we need to patch INSTALL.txt, then please do file a separate issue (Drupal Core / component = documentation) when you're ready.
So it looks like this is now a purely on-line documentation issue, since we don't apparently need to add anything to the core source to support nginx, from what I'm seeing above... So, I'm moving this issue to the Documentation queue so you can continue to collaborate on this. Thanks!
Comment #35
mitchell commentedMarking as fixed since Nginx is now included in the webserver docs.
There are still a lot of implied or hinted improvements. Here's what I see:
$requirements.Comment #37
mpark commentedHello,
would someone help me with install plain vps server for the fastest drupal (multisite)? (of course, nginx, php-ftp, microcache?)
Your effort can pay, of course. We can also arrange custom through freelancer.com.
Mark
Comment #38
batigolixYou are more likely to find support through the support channels listed at http://drupal.org/support
Comment #38.0
batigolixReferencing the comment instead of the whole thread.