Hi,<div><br></div><div>Small observation, from your configuration<div><br></div><div><a href="http://subdomain.mydomain.com">http://subdomain.mydomain.com</a><div><br></div><div>Will initiate a request to</div><div><br></div>
<div><a href="http://localhost:8080/subdomain/">http://localhost:8080/subdomain/</a></div><div><br></div><div>and not</div><div><br></div><div><meta http-equiv="content-type" content="text/html; charset=utf-8"><a href="http://localhost:8080/subdomain">http://localhost:8080/subdomain</a></div>
<div><br></div><div>[notice the /] which you said works in the browser. You might want to check that out.</div><div><br></div><div>Also, you can check out the tomcat's access logs to see what request you got.</div><div>
<br><div class="gmail_quote">On Wed, Nov 23, 2011 at 4:52 PM, nicksoft <span dir="ltr"><<a href="mailto:nginx-forum@nginx.us">nginx-forum@nginx.us</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi,<br>
<br>
I have a problem with configuration subdomains for nginx. I want to<br>
configure domains:<br>
<br>
<a href="http://mydomain.com" target="_blank">mydomain.com</a> (port 80) --> <a href="http://localhost:8080/" target="_blank">http://localhost:8080/</a><br>
<a href="http://www.mydomain.com" target="_blank">www.mydomain.com</a> (port 80) --> <a href="http://localhost:8080/" target="_blank">http://localhost:8080/</a><br>
<a href="http://subdomain.mydomain.com" target="_blank">subdomain.mydomain.com</a> (port 80) --> <a href="http://localhost:8080/subdomain" target="_blank">http://localhost:8080/subdomain</a><br>
<br>
<br>
Tomcat listening at 8080 port on localhost. I have application<br>
'subdomain' in tomcat webapps folder.<br>
<br>
<br>
<br>
This is my configuration file:<br>
------------------------------------------------------<br>
server<br>
{<br>
       listen       80;<br>
       server_name  <a href="http://mydomain.com" target="_blank">mydomain.com</a>;<br>
<br>
       # Main location<br>
       location /<br>
       {<br>
           proxy_pass         <a href="http://127.0.0.1:8080/" target="_blank">http://127.0.0.1:8080/</a>;<br>
           proxy_redirect     off;<br>
<br>
           proxy_set_header   Host             $host;<br>
           proxy_set_header   X-Real-IP        $remote_addr;<br>
           proxy_set_header   X-Forwarded-For<br>
$proxy_add_x_forwarded_for;<br>
<br>
           client_max_body_size       52m;<br>
           client_body_buffer_size    128k;<br>
<br>
           proxy_connect_timeout      3600;<br>
           proxy_send_timeout         3600;<br>
           proxy_read_timeout         90;<br>
<br>
           proxy_buffer_size          4k;<br>
           proxy_buffers              4 32k;<br>
           proxy_busy_buffers_size    64k;<br>
           proxy_temp_file_write_size 64k;<br>
           proxy_cache_valid 5m;<br>
       }<br>
}<br>
<br>
server<br>
{<br>
       listen       80;<br>
       server_name  <a href="http://www.mydomain.com" target="_blank">www.mydomain.com</a>;<br>
<br>
       # Main location<br>
       location /<br>
       {<br>
           proxy_pass         <a href="http://127.0.0.1:8080/" target="_blank">http://127.0.0.1:8080/</a>;<br>
           proxy_redirect     off;<br>
<br>
           proxy_set_header   Host             $host;<br>
           proxy_set_header   X-Real-IP        $remote_addr;<br>
           proxy_set_header   X-Forwarded-For<br>
$proxy_add_x_forwarded_for;<br>
<br>
           client_max_body_size       52m;<br>
           client_body_buffer_size    128k;<br>
<br>
           proxy_connect_timeout      3600;<br>
           proxy_send_timeout         3600;<br>
           proxy_read_timeout         90;<br>
<br>
           proxy_buffer_size          4k;<br>
           proxy_buffers              4 32k;<br>
           proxy_busy_buffers_size    64k;<br>
           proxy_temp_file_write_size 64k;<br>
           proxy_cache_valid 5m;<br>
       }<br>
}<br>
<br>
server<br>
{<br>
       listen       80;<br>
       server_name <a href="http://subdomain.mydomain.com" target="_blank">subdomain.mydomain.com</a>;<br>
<br>
       # Main location<br>
       location /<br>
       {<br>
           proxy_pass         <a href="http://127.0.0.1:8080/subdomain/" target="_blank">http://127.0.0.1:8080/subdomain/</a>;<br>
           proxy_redirect     off;<br>
<br>
           proxy_set_header   Host             $host;<br>
           proxy_set_header   X-Real-IP        $remote_addr;<br>
           proxy_set_header   X-Forwarded-For<br>
$proxy_add_x_forwarded_for;<br>
<br>
           client_max_body_size       52m;<br>
           client_body_buffer_size    128k;<br>
<br>
           proxy_connect_timeout      3600;<br>
           proxy_send_timeout         3600;<br>
           proxy_read_timeout         90;<br>
<br>
           proxy_buffer_size          4k;<br>
           proxy_buffers              4 32k;<br>
           proxy_busy_buffers_size    64k;<br>
           proxy_temp_file_write_size 64k;<br>
           proxy_cache_valid 5m;<br>
       }<br>
}<br>
------------------------------------------------------<br>
<br>
<br>
For this configuration http:/<a href="http://www.mydomain.com" target="_blank">www.mydomain.com</a>  and http:/<a href="http://mydomain.com" target="_blank">mydomain.com</a><br>
working very well, but <a href="http://subdomain.mydomain.com" target="_blank">subdomain.mydomain.com</a> doesn't work (there is no<br>
response from server).<br>
<br>
Oh, and <a href="http://mydomain.com/subdomain" target="_blank">http://mydomain.com/subdomain</a> in browser works well too.<br>
<br>
<br>
I will be grateful for your help.<br>
<br>
Posted at Nginx Forum: <a href="http://forum.nginx.org/read.php?2,218793,218793#msg-218793" target="_blank">http://forum.nginx.org/read.php?2,218793,218793#msg-218793</a><br>
<br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
</blockquote></div><br></div></div></div>