rewrite catch all subdomain

Igor Sysoev is at rambler-co.ru
Mon Mar 10 20:23:45 MSK 2008


On Mon, Mar 10, 2008 at 06:17:15PM +0100, Pedro Axl wrote:

> I'm not pretty sure what I'm doing, hehe. I have to open a new  server 
> {.....} right?
> 
> But If I do it when I try to start nginx I receive this error:
> Starting nginx: 2008/03/10 14:22:33 [emerg] 17834#0: directive "server" 
> in /etc/nginx/nginx.conf:81 is not allowed here

You configuraiton file should have the following structure:

http {

     server {
          location ... {
          }

          location ... {
          }

          location ... {
          }
     }

     server {

     }

You did not close some bracket.


> Igor Sysoev wrote:
> > On Mon, Mar 10, 2008 at 05:48:13PM +0100, Pedro Axl wrote:
> > 
> >> But if I go to anything.domain.com:8080 I receive the "Server not found" 
> >> error.
> > 
> >      server {
> >          listen  8080;
> >          server_name   domain.com;
> >          ...
> >      }
> > 
> >      server {
> >          listen  8080 default;
> >          server_name   *.domain.com;
> > 
> >          rewrite ^ http://mydomain.com:8080$uri last;
> >      }
> 
> -- 
> Posted via http://www.ruby-forum.com/.
> 

-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list