multy subdomain

Andrius Semionovas admin at agonija.eu
Sat Apr 25 19:35:49 MSD 2009


my configuration is:

server {
	listen       80;
	server_name  www.domain.com main.domain.com test.domain.com  
hight.domain.com;

	if ($host = 'www.domain.com') {
		root /www/server;
		access_log   logs/www.domain.com.log  main;
	}
	if ($host = 'main.domain.com') {
		root /www/main;
		access_log   logs/main.domain.com.log  main;
	}
	if ($host = 'test.domain.com') {
		root /www/test;
		access_log   logs/test.domain.com.log  main;
	}
	if ($host = 'hight.domain.com') {
		root /www/hight;
		access_log   logs/hight.domain.com.log  main;
	}
	
	location / {
		index index.php index.html index htm;
	}
	location /banner/ {
		root /www/server;
		autoindex on;
	}
	location ~ .php$ {
		fastcgi_pass   unix:/wwwserver/php/socket;
		include fastcgi.conf;
	}
	location ~ phpinfo.php$ {
		allow   78.56.76.213;
		deny  all;
	}
	location ~ do((0[1-9])|([1-9][0-9])).php {
		allow   78.56.76.213;
		deny  all;
	}
	location = /nginx_status {
		stub_status on;
		access_log   off;
		allow 78.56.76.213;
		deny all;
	}
	location = /chat {
		rewrite ^/chat(.*)$ /chat.php$1 break;
		root /www/chat;
		fastcgi_pass   unix:/wwwserver/php/socket;
		include fastcgi-main.conf;
	}
	location /userbar/ {
		rewrite ^/userbar/(.*)\.png$ /userbar.php?id=$1 break;
		fastcgi_pass   unix:/wwwserver/php/socket;
		include fastcgi-main.conf;
	}         	
}

but i get error:

2009/04/25 18:28:04 [emerg] 15472#0: "root" directive is not allowed here  
in /server/nginx/conf/virtual/www.domain.com:15

I want, each subdomain will but run from /www/<sudomain_name , but i not  
know how i can split adress into root, and if { root ****** } not work.  
'IF' need but into location

Sorry for my bad english





More information about the nginx mailing list