Forum: NGINX Re: New to nginx

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ivan L. (Guest)
on 2009-03-02 15:31
(Received via mailing list)
Thank you very much!





----- Original Message ----
From: Igor S. <removed_email_address@domain.invalid>
To: removed_email_address@domain.invalid
Sent: Sunday, March 1, 2009 7:29:37 PM
Subject: Re: New to nginx

On Sat, Feb 28, 2009 at 09:03:14PM -0800, Ivan L. wrote:

>
> > Why do you use "^/search$" ?
>
> I use this for the queries like "search?q=search_string"

Then you need just:

    location = /search {
        rewrite ^  /index.php?where=search last;
    }

    location /posts {
        rewrite ^/posts/(\d)$ /index.php?posts=$1 last;
    }

> >What do you expect here ?
>
> I wanted only GET|HEAD availability on some pages, and only POST on some pages.

    location = /about {
        if ($request_method != GET) {
            return 405;
        }
        rewrite ^  /index.php?where=about last;
    }

or

    location = /about {
        limit_except GET {
            deny all;
        }
        rewrite ^  /index.php?where=about last;
    }

> > What do you expect here ?
>
> That suppose to be a page that only accepts POST.

  location = /contact {
      if($request_method != POST) {
         return 405;
      }

      rewrite ^  /index.php?where=contact last;
  }

> >  location /downlods/ {
> >>    rewrite ^downloads/(.*)$ /downloads/$1 break;
> >>    return 403;
> >>  }
>
> > What do you expect here ?
>
> That's downloads folder, I wanted to disable directory listing.

Just:

  location /downlods/ {
  }
This topic is locked and can not be replied to.