Hello maybe someone can help with simple rewrites


I have difficulty converting these rewrite rules of apache into nginx.
Could someone please provide a helping hand.

RewriteRule ^(.*)$ %{SERVER_NAME}$1

RewriteCond %{SERVER_NAME}
RewriteRule ^([a-z0-9-]+).example.com/(.
/home/www/$1/$2 [L]

so if i go to test.example.com it should redirect me to

but in nginx somehow I get 2011/06/16 05:31:15 [error] 28649#0: *1
open() "/home/www///

it somehow does not recognize variables.

  server_name  ~^(.*)$;

   if ( $host ~ ^(.*)\.example\.com$ ) {
  rewrite ^([a-z0-9-]+)\.example\.com/(.*)$ 

/home/www/$1/$2 last;

root /home/www/$1/$2


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs