nginx for multiple sub-domain?

Igor Sysoev igor at sysoev.ru
Fri May 20 22:00:06 MSD 2011


On Fri, May 20, 2011 at 07:14:44PM +0200, Yanxin Z. wrote:
> Hello,
> I have a web site, e.g.,  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.

server {
    listen  80;
    server_name  www.example.com;
    location /query {
        ...
    }
}

server {
    listen  443;
    server_name  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;
         }
         ...
    }
}

http://nginx.org/en/docs/http/configuring_https_servers.html


-- 
Igor Sysoev



More information about the nginx mailing list