# Subdomain configuration problem

**URL:** <https://www.ruby-forum.com/t/subdomain-configuration-problem/242754>\
**Category:** NGINX\
**Created:** [July 19, 2015, 6:03pm UTC](https://www.ruby-forum.com/t/subdomain-configuration-problem/242754 "2015-07-19T18:03:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sadaf\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@Sadaf\_N](https://www.ruby-forum.com/u/Sadaf_N)\
**Post date:** [July 19, 2015, 6:03pm UTC](https://www.ruby-forum.com/t/subdomain-configuration-problem/242754/1 "2015-07-19T18:03:08Z")

</div>

Hi,

I’m beginner in nginx, and i have searched google and mailing list but  
no  
luck.

my nginx.conf:

http{  
server{  
listen 80;  
server\_name [example.com](http://example.com) [www.example.com](http://www.example.com);  
location / {  
proxy\_pass [http://127.0.0.1](http://127.0.0.1):aaaa/;  
}  
}  
server{  
listen 80;  
server\_name [subdomain.example.com](http://subdomain.example.com);  
location / {  
proxy\_pass [http://127.0.0.1](http://127.0.0.1):bbbb/;  
}  
}  
#rest of the default config like acces log, etc  
}

Problem is after adding server block for subdomain, both request (  
[example.com](http://example.com), [subdomain.example.com](http://subdomain.example.com)) loading only [example.com](http://example.com) in browser.  
If i place subdomain server block listing as first one, both request (  
[example.com](http://example.com), [subdomain.example.com](http://subdomain.example.com)) loading [subdomain.example.com](http://subdomain.example.com) in  
browser.

Please suggest me what could be the problem.

Thanks in Advance!!

---

<div class="post-metadata">

**Author:** ![murali\_kumar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e56c9b/32.png) [@murali\_kumar](https://www.ruby-forum.com/u/murali_kumar)\
**Post date:** [July 20, 2015, 5:14am UTC](https://www.ruby-forum.com/t/subdomain-configuration-problem/242754/2 "2015-07-20T05:14:54Z")

</div>

Hello!

On Sun, Jul 19, 2015 at 09:32:14PM +0530, murali kumar wrote:

> ```
> server_name example.com www.example.com;
> 
> ```
> 
> }
> 
> Please suggest me what could be the problem.

Likely reason is a typo in the domain name as listen in the  
“server\_name” directives.

–  
Maxim D.

> **[nginx](http://nginx.org/)**

---

<div class="post-metadata">

**Author:** ![murali\_kumar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e56c9b/32.png) [@murali\_kumar](https://www.ruby-forum.com/u/murali_kumar)\
**Post date:** [July 20, 2015, 2:14pm UTC](https://www.ruby-forum.com/t/subdomain-configuration-problem/242754/3 "2015-07-20T14:14:04Z")

</div>

Can’t believe!! You are right.

Thanks for the suggestion.
