# Nginx for multiple sub-domain?

**URL:** <https://www.ruby-forum.com/t/nginx-for-multiple-sub-domain/207223>\
**Category:** NGINX\
**Created:** [May 20, 2011, 7:14pm UTC](https://www.ruby-forum.com/t/nginx-for-multiple-sub-domain/207223 "2011-05-20T19:14:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [May 20, 2011, 7:14pm UTC](https://www.ruby-forum.com/t/nginx-for-multiple-sub-domain/207223/1 "2011-05-20T19:14:44Z")

</div>

Hello,  
I have a web site, e.g., [www.example.com](http://www.example.com)  
under it, i have several sub-domains, e.g., /register, /query, /report.

I have a requirement that,  
/query is for port 80  
/register is for port 443, but with server side SSL certificate  
verification.  
/report is for port 443 , with both server and client side SSL  
certificate verification.

I want to know whether NGX config can do this ?

I have the problem to config /register and /report under port 443.

Thanks,  
Yanxin

---

<div class="post-metadata">

**Author:** ![yanxin\_z](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/d6d6ee/32.png) [@yanxin\_z](https://www.ruby-forum.com/u/yanxin_z)\
**Post date:** [May 20, 2011, 8:00pm UTC](https://www.ruby-forum.com/t/nginx-for-multiple-sub-domain/207223/2 "2011-05-20T20:00:44Z")

</div>

On Fri, May 20, 2011 at 07:14:44PM +0200, Yanxin Z. wrote:

> I want to know whether NGX config can do this ?
> 
> I have the problem to config /register and /report under port 443.

server {  
listen 80;  
server\_name [www.example.com](http://www.example.com);  
location /query {  
…  
}  
}

server {  
listen 443;  
server\_name [www.example.com](http://www.example.com);

```
ssl on;
ssl_certificate www.nginx.com.crt;
ssl_certificate_key www.nginx.com.key;

ssl_verify_client optional;
ssl_client_certificate CA.crt;

location /register {
     ...
}

location /report {
     if ($ssl_client_verify != SUCCESS) {
         return 403;
     }
     ...
}

```

}

> **[Configuring HTTPS servers](http://nginx.org/en/docs/http/configuring_https_servers.html)**

–  
Igor S.

---

<div class="post-metadata">

**Author:** ![yanxin\_z](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/d6d6ee/32.png) [@yanxin\_z](https://www.ruby-forum.com/u/yanxin_z)\
**Post date:** [May 20, 2011, 8:50pm UTC](https://www.ruby-forum.com/t/nginx-for-multiple-sub-domain/207223/3 "2011-05-20T20:50:09Z")

</div>

Thank you Igor!!  
NGX is so powerful. It’s working for me.

Another question, for CA cert, I also need to verify PEM pass phase.  
Can I do it in NGX config?

Thanks,  
Yanxin
