Nginx Drupal Rewrite
Igor Sysoev
is at rambler-co.ru
Sat May 16 23:47:19 MSD 2009
On Sat, May 16, 2009 at 09:20:31PM +0200, Claude Bing wrote:
> Ok. Until I get this working, I'm re-enabling apache2 (sigh). I will work
> on this asap.
You may stay with 0.6.32 using
location / {
error_page 404 = /index.php?q=$uri;
log_not_found off;
}
> 2009/5/16 Igor Sysoev <is at rambler-co.ru>
>
> > On Sat, May 16, 2009 at 08:54:02PM +0200, Claude Bing wrote:
> >
> > > And how would I go about replacing my current version with the newest
> > one?
> > > I'm running Debian Lenny, so I just used apt-get install nginx (which I
> > know
> > > would yield a slightly older version, but it was much easier at the
> > time).
> > > Would I just download, compile, and install the source over the current
> > one?
> >
> > You may build nginx without package manager, but note, that default
> > nginx installation paths differ from Debian ones: you should use something
> > like this:
> >
> > ./configure --prefix=/usr --with-conf-path=/etc/nginx/nginx.conf ... etc.
> >
> > > 2009/5/16 Igor Sysoev <is at rambler-co.ru>
> > >
> > > > On Sat, May 16, 2009 at 08:35:25PM +0200, Claude Bing wrote:
> > > >
> > > > > *nginx version: nginx/0.6.32
> > > > > *
> > > >
> > > > You may upgrade to 0.6.36 or use
> > > >
> > > > location / {
> > > > error_page 404 = /index.php?q=$uri;
> > > > log_not_found off;
> > > > }
> > > >
> > > > on 0.6.32 instead of
> > > >
> > > > location / {
> > > > try_files $uri $uri/ /index.php?q=$uri;
> > > > }
> > > >
> > > > > 2009/5/16 Igor Sysoev <is at rambler-co.ru>
> > > > >
> > > > > > On Sat, May 16, 2009 at 08:19:50PM +0200, Claude Bing wrote:
> > > > > >
> > > > > > > It says to me when I use try_files "Unknown directive:
> > 'try_files'"
> > > > and
> > > > > > I
> > > > > > > don't know how to check the version number of nginx
> > > > > >
> > > > > > nginx -v
> > > > > >
> > > > > > > 2009/5/16 Igor Sysoev <is at rambler-co.ru>
> > > > > > >
> > > > > > > > On Sat, May 16, 2009 at 07:58:21PM +0200, Claude Bing wrote:
> > > > > > > >
> > > > > > > > > Can I just exclude a directory from rewrite?
> > > > > > > > > I suppose I can move the gallery to a subdomain.
> > > > > > > >
> > > > > > > > You do not need rewrite at all:
> > > > > > > >
> > > > > > > > root /var/www/wfto.cc;
> > > > > > > > index index.php index.html;
> > > > > > > >
> > > > > > > > location / {
> > > > > > > > try_files $uri $uri/ /index.php?q=$uri;
> > > > > > > > }
> > > > > > > >
> > > > > > > > location /gallery/ {
> > > > > > > > try_files $uri $uri/ /index.php?q=$uri;
> > > > > > > > }
> > > > > > > >
> > > > > > > > location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico)$ {
> > > > > > > > }
> > > > > > > >
> > > > > > > > location ~ \.php$ {
> > > > > > > > fastcgi_pass 127.0.0.1:9000;
> > > > > > > > ...
> > > > > > > > }
> > > > > > > >
> > > > > > > > > 2009/5/16 Claude Bing <tehbing at gmail.com>
> > > > > > > > >
> > > > > > > > > > K i will attempt to do this in a few minutes. I'll get
> > back to
> > > > you
> > > > > > > > about
> > > > > > > > > > the gallery
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > 2009/5/16 Igor Sysoev <is at rambler-co.ru>
> > > > > > > > > >
> > > > > > > > > >> On Sat, May 16, 2009 at 07:04:43PM +0200, Claude Bing
> > wrote:
> > > > > > > > > >>
> > > > > > > > > >> > Well I should clarify about the gallery. It's Gallery2,
> > > > > > php-driven.
> > > > > > > > > >>
> > > > > > > > > >> How does typical URL look ?
> > > > > > > > > >>
> > > > > > > > > >> > Where is the } that I should fix?
> > > > > > > > > >>
> > > > > > > > > >> I have marked the by "+" and "-":
> > > > > > > > > >>
> > > > > > > > > >> + }
> > > > > > > > > >>
> > > > > > > > > >> error_page 404 /index.php;
> > > > > > > > > >>
> > > > > > > > > >> location ~ /\.ht {
> > > > > > > > > >> deny all;
> > > > > > > > > >> }
> > > > > > > > > >> -}
> > > > > > > > > >> }
> > > > > > > > > >>
> > > > > > > > > >> > 2009/5/16 Igor Sysoev <is at rambler-co.ru>
> > > > > > > > > >> >
> > > > > > > > > >> > > On Sat, May 16, 2009 at 06:09:41PM +0200, Claude Bing
> > > > wrote:
> > > > > > > > > >> > >
> > > > > > > > > >> > > > Ok, I followed a tutorial online and was trying to
> > get
> > > > > > rewrite
> > > > > > > > > >> working on
> > > > > > > > > >> > > my
> > > > > > > > > >> > > > server. Well, everything works ok except for my
> > Photo
> > > > > > gallery
> > > > > > > > which
> > > > > > > > > >> is
> > > > > > > > > >> > > > located in | <domain>/gallery |. I'll include my
> > > > current
> > > > > > config
> > > > > > > > for
> > > > > > > > > >> the
> > > > > > > > > >> > > > domain (wfto.cc and wfto.cc/gallery)
> > > > > > > > > >> > > > ========================
> > > > > > > > > >> > > > server {
> > > > > > > > > >> > > > listen 80;
> > > > > > > > > >> > > > server_name www.waterfortheoppressed.com
> > > > > > > > > >> > > waterfortheoppressed.com;
> > > > > > > > > >> > > >
> > > > > > > > > >> > > > rewrite ^ http://wfto.cc permanent;
> > > > > > > > > >> > > > }
> > > > > > > > > >> > > >
> > > > > > > > > >> > > > server {
> > > > > > > > > >> > > > listen 80;
> > > > > > > > > >> > > > server_name www.wfto.cc wfto.cc;
> > > > > > > > > >> > > >
> > > > > > > > > >> > > >
> > > > > > > > > >> > > > access_log
> > /var/www/logs/wfto.cc.access.log;
> > > > > > > > > >> > > >
> > > > > > > > > >> > > > location = / {
> > > > > > > > > >> > > > root /var/www/wfto.cc;
> > > > > > > > > >> > > > index index.php index.html
> > index.htm;
> > > > > > > > > >> > > > }
> > > > > > > > > >> > > > location / {
> > > > > > > > > >> > > > root /var/www/wfto.cc;
> > > > > > > > > >> > > > index index.php index.html;
> > > > > > > > > >> > > >
> > > > > > > > > >> > > > if (!-f $request_filename) {
> > > > > > > > > >> > > > rewrite ^(.*)$ /index.php?q=$1
> > last;
> > > > > > > > > >> > > > break;
> > > > > > > > > >> > > > }
> > > > > > > > > >> > > >
> > > > > > > > > >> > > > if (!-d $request_filename) {
> > > > > > > > > >> > > > rewrite ^(.*)$ /index.php?q=$1
> > last;
> > > > > > > > > >> > > > break;
> > > > > > > > > >> > > > }
> > > > > > > > > >> > >
> > > > > > > > > >> > > + }
> > > > > > > > > >> > >
> > > > > > > > > >> > > > error_page 404 /index.php;
> > > > > > > > > >> > > >
> > > > > > > > > >> > > > # serve static files directly
> > > > > > > > > >> > > > location ~*
> > ^.+.(jpg|jpeg|gif|css|png|js|ico)$ {
> > > > > > > > > >> > > > access_log off;
> > > > > > > > > >> > > > expires 30d;
> > > > > > > > > >> > > > }
> > > > > > > > > >> > > > # redirect server error pages to the static
> > page
> > > > > > > > /50x.html
> > > > > > > > > >> > > > #
> > > > > > > > > >> > > > error_page 500 502 503 504 /50x.html;
> > > > > > > > > >> > > > location = /50x.html {
> > > > > > > > > >> > > > root /var/www/nginx-default;
> > > > > > > > > >> > > > }
> > > > > > > > > >> > > >
> > > > > > > > > >> > > > # proxy the PHP scripts to Apache listening
> > on
> > > > > > > > 127.0.0.1:80
> > > > > > > > > >> > > > #
> > > > > > > > > >> > > > #location ~ \.php$ {
> > > > > > > > > >> > > > #proxy_pass http://127.0.0.1;
> > > > > > > > > >> > > > #}
> > > > > > > > > >> > > >
> > > > > > > > > >> > > > # pass the PHP scripts to FastCGI server
> > > > listening
> > > > > > on
> > > > > > > > > >> > > 127.0.0.1:9000
> > > > > > > > > >> > > > #
> > > > > > > > > >> > > > location ~ \.php$ {
> > > > > > > > > >> > > > fastcgi_pass 127.0.0.1:9000;
> > > > > > > > > >> > > > fastcgi_index index.php;
> > > > > > > > > >> > > > fastcgi_param SCRIPT_FILENAME
> > > > > > > > > >> > > > /var/www/wfto.cc$fastcgi_script_name;
> > > > > > > > > >> > > > include fastcgi_params;
> > > > > > > > > >> > > > }
> > > > > > > > > >> > > >
> > > > > > > > > >> > > > # deny access to .htaccess files, if
> > Apache's
> > > > > > document
> > > > > > > > root
> > > > > > > > > >> > > > # concurs with nginx's one
> > > > > > > > > >> > > > #
> > > > > > > > > >> > > > location ~ /\.ht {
> > > > > > > > > >> > > > deny all;
> > > > > > > > > >> > > > }
> > > > > > > > > >> > > > }
> > > > > > > > > >> > >
> > > > > > > > > >> > > - }
> > > > > > > > > >> > >
> > > > > > > > > >> > > > }
> > > > > > > > > >> > > > ========================
> > > > > > > > > >> > >
> > > > > > > > > >> > > First, you should fix '}',
> > > > > > > > > >> > > Second, use try_files instead of "if"s.
> > > > > > > > > >> > > And third, your gallery probably is served as static
> > files
> > > > by
> > > > > > > > > >> > >
> > > > > > > > > >> > > location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico)$
> > {
> > > > > > > > > >> > >
> > > > > > > > > >> > >
> > > > > > > > > >> > > --
> > > > > > > > > >> > > Igor Sysoev
> > > > > > > > > >> > > http://sysoev.ru/en/
> > > > > > > > > >> > >
> > > > > > > > > >> > >
> > > > > > > > > >> >
> > > > > > > > > >> >
> > > > > > > > > >> > --
> > > > > > > > > >> >
> > > > > > > > > >> > Yogi Berra <
> > > > > > > > http://www.brainyquote.com/quotes/authors/y/yogi_berra.html>
> > > > > > > > > >> -
> > > > > > > > > >> > "If you ask me anything I don't know, I'm not going to
> > > > answer."
> > > > > > > > > >>
> > > > > > > > > >> --
> > > > > > > > > >> Игорь Сысоев
> > > > > > > > > >> http://sysoev.ru
> > > > > > > > > >>
> > > > > > > > > >>
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > --
> > > > > > > > > >
> > > > > > > > > > Bill Cosby <
> > > > > > > > http://www.brainyquote.com/quotes/authors/b/bill_cosby.html> -
> > > > > > "Fatherhood
> > > > > > > > is pretending the present you love most is soap-on-a-rope."
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > --
> > > > > > > > >
> > > > > > > > > Yogi Berra <
> > > > > > http://www.brainyquote.com/quotes/authors/y/yogi_berra.html>
> > > > > > > > -
> > > > > > > > > "If you ask me anything I don't know, I'm not going to
> > answer."
> > > > > > > >
> > > > > > > > --
> > > > > > > > Igor Sysoev
> > > > > > > > http://sysoev.ru/en/
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > >
> > > > > > > Casey Stengel<
> > > > > > http://www.brainyquote.com/quotes/authors/c/casey_stengel.html>
> > > > > > > - "There comes a time in every man's life, and I've had plenty of
> > > > > > > them."
> > > > > >
> > > > > > --
> > > > > > Igor Sysoev
> > > > > > http://sysoev.ru/en/
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > >
> > > > > Yogi Berra <
> > http://www.brainyquote.com/quotes/authors/y/yogi_berra.html>
> > > > -
> > > > > "If you ask me anything I don't know, I'm not going to answer."
> > > >
> > > > --
> > > > Igor Sysoev
> > > > http://sysoev.ru/en/
> > > >
> > > >
> > >
> > >
> > > --
> > >
> > > Laurence J. Peter<
> > http://www.brainyquote.com/quotes/authors/l/laurence_j_peter.html>
> > > - "Originality is the fine art of remembering what you hear but
> > > forgetting
> > > where you heard it."
> >
> > --
> > Igor Sysoev
> > http://sysoev.ru/en/
> >
> >
>
>
> --
>
> Bill Cosby <http://www.brainyquote.com/quotes/authors/b/bill_cosby.html> -
> "Fatherhood is pretending the present you love most is soap-on-a-rope."
--
Igor Sysoev
http://sysoev.ru/en/
More information about the nginx
mailing list