Welcome! Log In Create A New Profile

Advanced

configuration problem with subdomain and proxy_pass

November 23, 2011 06:22AM
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.
Subject Author Posted

configuration problem with subdomain and proxy_pass

nicksoft November 23, 2011 06:22AM

Re: configuration problem with subdomain and proxy_pass

faskiri.devel November 23, 2011 07:32AM

Re: configuration problem with subdomain and proxy_pass

nicksoft November 23, 2011 08:59AM

Re: configuration problem with subdomain and proxy_pass

nicksoft November 23, 2011 09:26AM

Re: configuration problem with subdomain and proxy_pass

nicksoft November 23, 2011 12:08PM

Re: configuration problem with subdomain and proxy_pass

nicksoft November 23, 2011 12:10PM

Re: configuration problem with subdomain and proxy_pass

nicksoft November 23, 2011 01:18PM

Re: configuration problem with subdomain and proxy_pass

Fasihullah Askiri November 23, 2011 11:10AM

Re: configuration problem with subdomain and proxy_pass

faskiri.devel November 23, 2011 12:18PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 220
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready