Welcome! Log In Create A New Profile

Advanced

Re: drupal+nginx: this works => using try_files

mike
March 17, 2009 01:37PM
2009/3/17 Mark Alan <varia@e-healthexpert.org>:
> The following has been tested in Nginx  0.7.42 + Drupal 6.10 + Ubuntu 8.10.
>
> M.
>

Seems to me that

a) drupal should not include scripts/etc. that should not be ran via
the web -in- the webroot, or
b) they should be localized to only one directory

> # hide drupal system files
> location ~*
> ((cron\.php|settings\.php)|\.(htaccess|engine|inc|info|install|module|profile|pl|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(Entries.*|Repository|Root|Tag|Template))$
> {
> deny all;
> }

That is ugly as sin to me, and could change at any given time. Is
there a true need to protect all of these? Is it only a specific
folder?You could always use location /folder { internal; } then too.

you can add these to fastcgi_params, no need for repetition:
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;

I'm just trying to approach this from a purely KISS perspective. I
hate seeing denormalized/excessive configs. Especially since I host a
drupal instance I want the cleanest possible ;)

and actually, since drupal has nothing really specific besides a
single line, you could get away with:

try_files $uri $uri/ /index.php?q=$request_uri; ($uri might
work too - might warrant testing the two, I'm trying to find the
difference between the two on the wiki)

I also have an open question to the list about using try_files with
multiple prefixes... i.e.:

location /drupal {
try_files $uri $uri/ /drupal/index.php?q=$request_uri
}

# wordpress, for example
location /blog {
try_files $uri $uri/ /blog/index.php?q=$request_uri
}

I don't really like the current wiki examples either. It's got a mix
of parsing php and try_files and other wacky stuff that will just lead
to confusion.
Subject Author Posted

drupal+nginx: this works => using try_files

Mark Alan March 17, 2009 06:01AM

Re: drupal+nginx: this works => using try_files

mike March 17, 2009 01:37PM

Re: drupal+nginx: this works => using try_files

mike March 17, 2009 02:05PM

Re: drupal+nginx: this works => using try_files

Mark Alan March 17, 2009 04:13PM

Re: drupal+nginx: this works => using try_files

mike March 17, 2009 06:44PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 67
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready