configuration problem with subdomain and proxy_pass

Fasih faskiri.devel at gmail.com
Wed Nov 23 12:31:48 UTC 2011


Hi,

Small observation, from your configuration

http://subdomain.mydomain.com

Will initiate a request to

http://localhost:8080/subdomain/

and not

http://localhost:8080/subdomain

[notice the /] which you said works in the browser. You might want to check
that out.

Also, you can check out the tomcat's access logs to see what request you
got.

On Wed, Nov 23, 2011 at 4:52 PM, nicksoft <nginx-forum at nginx.us> wrote:

> Hi,
>
> I have a problem with configuration subdomains for nginx. I want to
> configure domains:
>
> mydomain.com (port 80) --> http://localhost:8080/
> www.mydomain.com (port 80) --> http://localhost:8080/
> subdomain.mydomain.com (port 80) --> http://localhost:8080/subdomain
>
>
> Tomcat listening at 8080 port on localhost. I have application
> 'subdomain' in tomcat webapps folder.
>
>
>
> This is my configuration file:
> ------------------------------------------------------
> server
> {
>       listen       80;
>       server_name  mydomain.com;
>
>       # Main location
>       location /
>       {
>           proxy_pass         http://127.0.0.1:8080/;
>           proxy_redirect     off;
>
>           proxy_set_header   Host             $host;
>           proxy_set_header   X-Real-IP        $remote_addr;
>           proxy_set_header   X-Forwarded-For
> $proxy_add_x_forwarded_for;
>
>           client_max_body_size       52m;
>           client_body_buffer_size    128k;
>
>           proxy_connect_timeout      3600;
>           proxy_send_timeout         3600;
>           proxy_read_timeout         90;
>
>           proxy_buffer_size          4k;
>           proxy_buffers              4 32k;
>           proxy_busy_buffers_size    64k;
>           proxy_temp_file_write_size 64k;
>           proxy_cache_valid 5m;
>       }
> }
>
> server
> {
>       listen       80;
>       server_name  www.mydomain.com;
>
>       # Main location
>       location /
>       {
>           proxy_pass         http://127.0.0.1:8080/;
>           proxy_redirect     off;
>
>           proxy_set_header   Host             $host;
>           proxy_set_header   X-Real-IP        $remote_addr;
>           proxy_set_header   X-Forwarded-For
> $proxy_add_x_forwarded_for;
>
>           client_max_body_size       52m;
>           client_body_buffer_size    128k;
>
>           proxy_connect_timeout      3600;
>           proxy_send_timeout         3600;
>           proxy_read_timeout         90;
>
>           proxy_buffer_size          4k;
>           proxy_buffers              4 32k;
>           proxy_busy_buffers_size    64k;
>           proxy_temp_file_write_size 64k;
>           proxy_cache_valid 5m;
>       }
> }
>
> server
> {
>       listen       80;
>       server_name subdomain.mydomain.com;
>
>       # Main location
>       location /
>       {
>           proxy_pass         http://127.0.0.1:8080/subdomain/;
>           proxy_redirect     off;
>
>           proxy_set_header   Host             $host;
>           proxy_set_header   X-Real-IP        $remote_addr;
>           proxy_set_header   X-Forwarded-For
> $proxy_add_x_forwarded_for;
>
>           client_max_body_size       52m;
>           client_body_buffer_size    128k;
>
>           proxy_connect_timeout      3600;
>           proxy_send_timeout         3600;
>           proxy_read_timeout         90;
>
>           proxy_buffer_size          4k;
>           proxy_buffers              4 32k;
>           proxy_busy_buffers_size    64k;
>           proxy_temp_file_write_size 64k;
>           proxy_cache_valid 5m;
>       }
> }
> ------------------------------------------------------
>
>
> For this configuration http:/www.mydomain.com  and http:/mydomain.com
> working very well, but subdomain.mydomain.com doesn't work (there is no
> response from server).
>
> Oh, and http://mydomain.com/subdomain in browser works well too.
>
>
> I will be grateful for your help.
>
> Posted at Nginx Forum:
> http://forum.nginx.org/read.php?2,218793,218793#msg-218793
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20111123/801c7670/attachment.html>


More information about the nginx mailing list