Добрый день. Не могу добиться от nginx казалось бы простой вещи. Есть nginx, и есть jetty за ним. Нужно чтобы пользователь заходил на URL m.domain.ru, а jetty думал что пришли по URL m.domain.ru/m. При этом в адресной строке пользователя /m не отображалось.
Вот текущий конфиг: nginx.conf ===================== ... server { server_name domain.ru *.domain.ru; set $subdomain ""; if ($host = "m.domain.ru") { set $subdomain "m"; } root /opt/jetty/webapps/root/WEB-INF/application/; location / { proxy_pass http://127.0.0.1:8080/$subdomain; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_cache off; proxy_redirect off; } } ... ======================== Были и другие варианты конфигурации. Например вот такой: ... server { server_name ~^(.*)\.domain\.ru$; set $subdomain $1; root /opt/jetty/webapps/root/WEB-INF/application/; location / { proxy_pass http://127.0.0.1:8080/$subdomain; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; proxy_cache off; proxy_redirect off; } } ... При попытке входа на m.domain.ru выдается ошибка 404, а на domain.ru грузится сайт, но без всей статики (подозреваю что это ошибка бэкэнда). Не понятно как именно переписывается URL, но явно не так, как я ожидаю. Как заставить nginx писать в логи всё, что происходит? Логгирование настроено вот так: ... error_log /var/log/nginx/error.log info; http { ... log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; rewrite_log on; .... } ... nginx такой: nginx version: nginx/1.5.1 built by gcc 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC) TLS SNI support enabled configure arguments: --prefix=/opt/nginx --user=nginx --group=nginx --with-poll_module --with-file-aio --with-http_ssl_module --with-http_spdy_module --with-http_realip_module --with-http_addition_module --with-http_image_filter_module --with-http_geoip_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gzip_static_module --with-http_stub_status_module --with-pcre Posted at Nginx Forum: http://forum.nginx.org/read.php?21,240295,240295#msg-240295 _______________________________________________ nginx-ru mailing list nginx-ru@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-ru