Is that possible to define a common location handler for all servers

Igor Sysoev igor at sysoev.ru
Tue Aug 30 05:24:27 UTC 2011


On Mon, Aug 29, 2011 at 10:19:30PM -0700, Qun-Ying wrote:
> Hi,
> 
> Let's say we have a sample configuration:
> 
> http {
>    server {
>      server_name "server1"
>   }
> 
>  server {
>     server_name "server2"
> }
> ..
> }
> 
> Is that possible to define a single location entry (not using the include
> directive, which actually defined the entry for each server after include
> expand)
> location /error {
>     error_handler
> }
> So that it could be use in all servers?
> 
> I try to define it at http level, but encounter error saying location could
> not be defined outside server.

It's not possible.


-- 
Igor Sysoev



More information about the nginx-devel mailing list