# Wildcard domains as vhost

**URL:** <https://www.ruby-forum.com/t/wildcard-domains-as-vhost/207350>\
**Category:** NGINX\
**Created:** [May 24, 2011, 4:01pm UTC](https://www.ruby-forum.com/t/wildcard-domains-as-vhost/207350 "2011-05-24T16:01:28Z")\
**Posts on this page:** 4\
**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:** [May 24, 2011, 4:01pm UTC](https://www.ruby-forum.com/t/wildcard-domains-as-vhost/207350/1 "2011-05-24T16:01:28Z")

</div>

I tried to google this but could not hit the right keywords (been a long  
week)…

We have DNS set up so that all requests ending in .project.example.com  
(i.e.  
[bob.project.example.com](http://bob.project.example.com)) go to the same machine. How can I set up  
sites-enabled so that all requests for \*.project.example.com get treated  
the  
same?

Thanks,  
John

---

<div class="post-metadata">

**Author:** ![John\_Kennedy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e9a140/32.png) [@John\_Kennedy](https://www.ruby-forum.com/u/John_Kennedy)\
**Post date:** [May 24, 2011, 4:04pm UTC](https://www.ruby-forum.com/t/wildcard-domains-as-vhost/207350/2 "2011-05-24T16:04:33Z")

</div>

look in the wiki at the server\_name directive. (wildcards)

---

<div class="post-metadata">

**Author:** ![John\_Kennedy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e9a140/32.png) [@John\_Kennedy](https://www.ruby-forum.com/u/John_Kennedy)\
**Post date:** [May 24, 2011, 4:12pm UTC](https://www.ruby-forum.com/t/wildcard-domains-as-vhost/207350/3 "2011-05-24T16:12:37Z")

</div>

That was what I was looking for.  
Thanks.  
John

---

<div class="post-metadata">

**Author:** ![John\_Kennedy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e9a140/32.png) [@John\_Kennedy](https://www.ruby-forum.com/u/John_Kennedy)\
**Post date:** [May 24, 2011, 4:14pm UTC](https://www.ruby-forum.com/t/wildcard-domains-as-vhost/207350/4 "2011-05-24T16:14:28Z")

</div>

On 24 Mai 2011 15h00 WEST, [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> [1 \<multipart/alternative (7bit)\>] [1.1 \<text/plain; ISO-8859-1  
> (7bit)\>] I tried to google this but could not hit the right keywords  
> (been a long week)…
> 
> We have DNS set up so that all requests ending in  
> .project.example.com (i.e. [bob.project.example.com](http://bob.project.example.com)) go to the same  
> machine. How can I set up sites-enabled so that all requests for  
> \*.project.example.com get treated the same?

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

server {  
server\_name \*.project.example.com;  
(…)  
}

— appa
