Welcome! Log In Create A New Profile

Advanced

Re: multy subdomain

April 25, 2009 11:55AM
On Sat, Apr 25, 2009 at 06:35:49PM +0300, Andrius Semionovas wrote:

> 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

server {
server_name www.domain.com;

root /www/server;
access_log logs/www.domain.com.log main;

location / {
...
}

...
}

server {
server_name main.domain.com;

root /www/main;
access_log logs/main.domain.com.log main;

location / {
...
}

...
}


--
Igor Sysoev
http://sysoev.ru/en/
Subject Author Posted

multy subdomain

Andrius Semionovas April 25, 2009 11:35AM

Re: multy subdomain

Igor Sysoev April 25, 2009 11:55AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 299
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready