GitHub configuration files

Michael Shadle mike503 at gmail.com
Thu Aug 26 00:16:56 MSD 2010


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. :)

On Wed, Aug 25, 2010 at 1:09 PM, nofun <nginx-forum at nginx.us> wrote:
> 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
>
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://nginx.org/mailman/listinfo/nginx
>



More information about the nginx mailing list