# Sub-domains only server for web application?

**URL:** <https://www.ruby-forum.com/t/sub-domains-only-server-for-web-application/214056>\
**Category:** NGINX\
**Created:** [November 20, 2011, 10:06am UTC](https://www.ruby-forum.com/t/sub-domains-only-server-for-web-application/214056 "2011-11-20T10:06:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [November 20, 2011, 10:06am UTC](https://www.ruby-forum.com/t/sub-domains-only-server-for-web-application/214056/1 "2011-11-20T10:06:13Z")

</div>

Our website currently runs wordpress to manage the front end site  
[www.example.com](http://www.example.com)

When users register they get a subdomain [username.example.com](http://username.example.com) where they  
can login to our application. The application is built on zend  
framework. I’d like to have the zf project on an entirely different  
server than where we run the wordpress [www.example.com](http://www.example.com) domain.

How would the default server config be setup since the front end site is  
on another server with different IP? Virtual hosts would be setup as  
usual, i’m just not sure how to configure the main server so it  
redirects to [www.example.com](http://www.example.com)? Any help is appreciated

Thanks

Posted at Nginx Forum:

> **[Sub-domains only server for web application?](https://forum.nginx.org/read.php?2,218630,218630#msg-218630)**
>
> Our website currently runs wordpress to manage the front end site www.example.com When users register they get a subdomain username.example.com where they can login to our application. The application is built on zend framework. I'd like to have the...

---

<div class="post-metadata">

**Author:** ![anagio](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/977dab/32.png) [@anagio](https://www.ruby-forum.com/u/anagio)\
**Post date:** [November 20, 2011, 10:22am UTC](https://www.ruby-forum.com/t/sub-domains-only-server-for-web-application/214056/2 "2011-11-20T10:22:52Z")

</div>

On 20 Nov 2011 09h05 WET, [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Our website currently runs wordpress to manage the front end site  
> [www.example.com](http://www.example.com)
> 
> When users register they get a subdomain [username.example.com](http://username.example.com) where  
> they can login to our application. The application is built on zend  
> framework. I’d like to have the zf project on an entirely different  
> server than where we run the wordpress [www.example.com](http://www.example.com) domain.

If I understand correctly. Try:

server { # frontend  
listen [::]:80 default\_server;  
server\_name [www.example.com](http://www.example.com);  
}

server { # backend  
listen [::]:80;  
server\_name \*.example.com;  
}

Check: [Server names](http://nginx.org/en/docs/http/server_names.html)

> How would the default server config be setup since the front end  
> site is on another server with different IP? Virtual hosts would be  
> setup as usual, i’m just not sure how to configure the main server  
> so it redirects to [www.example.com](http://www.example.com)? Any help is appreciated

— appa
