nginx Автоматическая генерация поддоменов
Вот конфиг для /etc/nginx/sites-available/default
server {
listen 80;
index index.php;
server_name example.com *.example.com;
root /www/$subdomain;
set $subdomain «»;
if ($host ~* ^([a-z0-9-\.]+)\.localhost$) {
set $subdomain $1;
}
if ($host ~* ^localhost$) {
set $subdomain «»;
}
charset utf-8;
location / {
try_files $uri $uri/ /index.php;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
Теперь можно просто создавать в www папки и они будут доступны как поддомены *.localhost
Например:
/www/some
some.localhost
more:http://badphpcoder.blogspot.com/2014/01/nginx.html
Разумеется предварительно нужно будет поправить /etc/hosts