Поддомены у nginx

Sprinx

Пользователь
#1
Всем привет.
Не получается настроить поддомены на nginx.Что только не пробовал, ни чего не помогает.
Помогите кто может.

nginx.conf
user www-data;
worker_processes 2;

timer_resolution 100ms;
worker_rlimit_nofile 8192;
worker_priority -5;

error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
access_log /var/log/nginx/access.log;

sendfile on;
keepalive_timeout 65;
tcp_nodelay on;
tcp_nopush on;
types_hash_max_size 2048;
server_tokens off;
client_max_body_size 10m;

fastcgi_param HTTP_HOST1 $http_host;
fastcgi_param HTTP_HOST2 $host;
fastcgi_param HTTP_HOST3 $server_name;

gzip on;
gzip_min_length 1100;
gzip_disable "msie6";
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
gzip_proxied any;
gzip_comp_level 4;
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_vary on;

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}

содержимое папки nginx/sites-enabled
файл domen.ru
server {
root /var/www/domen.ru;
index index.php;
server_name domen.ru

Please Login or Register to view hidden text.


charset utf8;

location / {

try_files $uri $uri/ /index.html;

}

location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
}



# Cached Images
location ~* \.(jpg|jpeg|gif|png|css|js|ico)$ {
root /var/www/domen.ru;
access_log off;
expires 30d;
add_header Cache-Control public;
}

location ~ \/admin|backup\/ {
deny all;
}
# Deny folder (Sec. lvl1)
location ~ \/(cache|log|attach_mod|cache|config|includes|language|triggers)\/ {
deny all;
}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
# deny sql,tpl,db,inc,log
location ~ /\.ht {
deny all;
}
location ~ \.(.*sql|tpl|db|inc|log)$ {
deny all;
}

location /phpmyadmin {
root /usr/share/;
index index.php;
location ~ ^/phpmyadmin/(.+\.php)$ {
try_files $uri =404;
root /usr/share/;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
fastcgi_buffer_size 128k;
fastcgi_buffers 256 4k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
fastcgi_intercept_errors on;
}
location ~* ^/phpMyAdmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
root /usr/share/;
}
}
location /phpMyAdmin {
rewrite ^/* /phpmyadmin last;
}

location /squirrelmail {
root /usr/share/;
index index.php index.html index.htm;
location ~ ^/squirrelmail/(.+\.php)$ {
try_files $uri =404;
root /usr/share/;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;
include /etc/nginx/fastcgi_params;
}
location ~* ^/squirrelmail/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
root /usr/share/;
}
}
location /webmail {
rewrite ^/* /squirrelmail last;
}

}
Поддомен создаю отдельным файлом с секцией server {}.
 

Sprinx

Пользователь
#6
Я создавал новый файл в папке sites-enabled.Туда запихиваю секцию server {} с простыми параметрами.
server {
listen 80;
server_name test.domen.ru;

location / {
root /var/www/test.domen.ru;
index index.php index.html index.htm;
}
}
И в итоге Сервер не найден.
 

Sprinx

Пользователь
#10
У меня основной сайт работает.Только поддомены не хотят открываться.
Причем здесь dns?
 
Сверху