Хочется сделать автоматические поддомены как в nginx, так и в апач.<br>Для nginx написан конфиг следующий:<br><br> server {<br> listen xxx.xxx.xx.xxx;<br> server_name <a href="http://domain.ru">domain.ru</a> *.<a href="http://domain.ru">domain.ru</a>;<br>
access_log /var/log/nginx/domain-access;<br> error_log /var/log/nginx/domain-error error;<br><br> root /var/www/domain/$subdomain;<br> set $subdomain "";<br> if ($host ~* ^([a-z0-9-\.]+)\.<a href="http://domain.ru">domain.ru</a>$) {<br>
set $subdomain $1;<br> }<br> if ($host ~* ^<a href="http://www.domain.ru">www.domain.ru</a>$) {<br> set $subdomain "";<br> }<br><br>location / {<br> proxy_pass <a href="http://127.0.0.1:8000/">http://127.0.0.1:8000/</a>;<br>
index index.html index.php;<br> proxy_set_header Host $host;<br> proxy_set_header X-Real-IP $remote_addr;<br> proxy_set_header X-Forwarded-For $remote_addr;<br>
}<br>}<br><br>Для апача такой конфиг:<br><br><VirtualHost <a href="http://127.0.0.1:8000">127.0.0.1:8000</a>><br> ServerName <a href="http://domain.ru">domain.ru</a><br> ServerAlias *.<a href="http://domain.ru">domain.ru</a><br>
DocumentRoot /var/www/domain<br> ErrorLog "/var/log/apache2/domain-error.log"<br> CustomLog "/var/log/apache2/domain-access.log" combined<br><br> RewriteEngine On<br> RewriteCond %{HTTP_HOST} !^<a href="http://www.domain.ru">www.domain.ru</a>$<br>
RewriteCond %{HTTP_HOST} ^((.*).)<a href="http://domain.ru">domain.ru</a>$ [NC]<br> RewriteRule ^/(.*) /%2/$1 [L,QSA]<br><Directory "/var/www/domain"><br> Options FollowSymLinks -MultiViews -Indexes<br>
AllowOverride All<br> Order allow,deny<br> Allow from all<br></directory><br><br> RPAFenable On<br> RPAFsethostname On<br> RPAFproxy_ips 127.0.0.1<br> RPAFheader X-Real-IP<br><br></VirtualHost><br>
<br clear="all">Вопрос в том, что если обратиться к <a href="http://subdomain.domain.ru">subdomain.domain.ru</a> - перекидывает на <a href="http://domain.ru">domain.ru</a>, если набрать <a href="http://subdomain.domain.ru/index.php">subdomain.domain.ru/index.php</a> - отдаст как надо. Может быть кто-то знает как это победить..<br>
<br>-- <br>Best regards,<br>Anton Kiryushkin,<br> <br>