GitHub configuration files

Hello,

I am trying to put together a set of configuration files, generalized
for different web applications (for the moment just Drupal and
WordPress) and with added security. All of them will be modular so that
they can be interchanged, and also I tried to listen to many advices on
this forum, like the use of try_files instead of if, etc. And of course
this needs to be very simple and general so any custom modifications
will be excluded, so that the files can be used on any system and
application. Also, they are made just for NginX and PHP-FPM (or
FastCGI)

This is available at http://github.com/vladgh/nginx and I am open to any
suggestions that you may have.

I am doing this because for the moment finding a good configuration
example is very difficult and involves a lot of searching and
trial&error. Most of them are intended for very specific applications
and must be heavily customized to get them working. You are welcomed to
add any comment you might have.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,123720,123720#msg-123720

I had thought of posting some recipes up at one point as well.

all other requests go to Wordpress

    if (!-e $request_filename) {
      rewrite ^/(.*)$ /index.php?q=$1 last;
      rewrite /(.*)/$ /index.php?q=$1 last;
      break;
    }

I don’t think you need that; probably simpler to do try_files there.

I haven’t used wp supercache; I would make two configs, one for
wordpress and one for wordpress with wp supercache. Because my default
wordpress and drupal configs are basically just try_files lines.

Drupal 6 doesn’t support try_files, still needs the if (-e) check.
Drupal 7 works.
Drupal also has a lot of stuff in the document root to set to
“internal” sadly. So I have a location block to handle that.

At the moment, this is my working Drupal 6 config:

if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php?q=$1 last;
}

location ~*
.(engine|inc|info|install|module|profile|po|sh|.sql|theme|tpl(.php)?|xtmpl)$|^(code-style.pl|Entries.|Repository|Root|Tag|Template)$
{
internal;
}
location ~ /sites/all/scripts/.* { internal; }
location ~ /sites/all/modules/apachesolr/solrbase/.* { internal; }

for wordpress:

all you need is:
try_files $uri $uri/ /index.php?page=$request_uri;

see
http://michaelshadle.com/2010/08/20/front-controller-patterns-and-nginx/

always start out simple, and build from there. :slight_smile:

Thank you for the reply, I will make the necessary changes as soon as
possible. This is exactly why I started this project. Nobody tells you
this stuff, and the configuration files are scattered all over the
internet. And this leads to misconfiguration of nginx and thus to
unsatisfied users. NginX is a great program with great potential and
should be used accordingly.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,123720,123729#msg-123729

drupal on nginx is pretty much covered in these two conf

http://github.com/yhager/nginx_drupal
http://github.com/omega8cc/nginx-for-drupal Grace updated the repo so
the actual nginx.conf for drupal is burried in a old commit
http://github.com/omega8cc/nginx-for-drupal/commit/9e0a964a986f7b44fbc1b09028b77c160619a8c1#diff-6

Also, read http://groups.drupal.org/nginx

I respect the work of the people you mentioned, and most of the
configuration I gathered is from both of these sources, but I don’t want
to limit this to only drupal, or worpdress but also other applications.
Unlike YHager’s repo I would like to update this with all possible
security rules and maybe better organize it. On the other hand Grace’s
configuration is extremely bloated. I don’t really need or afford a
system with aegir, varnish etc.
With advices from you I would like to do this very modular, so that when
someone needs a certain configuration or rules for just a specific
module, it will be available. That’s why I posted this here, to get
feedback. I still have a long way, but it will be soon a good reference
point for a simple nginx machine.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,123720,123806#msg-123806

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs