title: ssl for subdirectory within nginx server configuration
body: <p>I have a nginx server running with ssl enabled. 
  Currently I have https enabled for all directories.
  How enable ssl only for <code>www.example.com/shop/*</code> directory and disable for other??</p>
  
  <p>here is my conf file : </p>
  
  <pre><code>    # Redirect everything to the main site.
  server {
    server_name *.example.com;
    listen 80;
    ssl on;
    ssl_certificate /opt/nginx/conf/server.crt;
    ssl_certificate_key /opt/nginx/conf/server.key; 
    keepalive_timeout    70;
  
    access_log  /home/example/nginx_logs/access.log ;
    error_log  /home/example/nginx_logs/error.log ;
  
    root /home/example/public_html/example.com;   
    location ~ \.php$ {
        try_files $uri $uri/ /index.php?q=$uri&amp;$args;         
        root          /home/example/public_html/example.com/;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        include        /opt/nginx/conf/fastcgi_params;
        #fastcgi_param   SCRIPT_FILENAME    $document_root$fastcgi_script;
        fastcgi_param   SCRIPT_NAME        $fastcgi_script_name;
        fastcgi_param  SCRIPT_FILENAME  /home/example/public_html/example.com$fastcgi_script_name;
        index  index.php index.html index.htm;   
    }
  
      if ($http_host != "example.com") {
          rewrite ^ http://example.com$request_uri permanent;
      }
  
      include global/restrictions.conf;
  
      # Additional rules go here.
  
      #Only include one of the files below.
      include global/wordpress.conf;
  #   include global/wordpress-ms-subdir.conf;
  #   include global/wordpress-ms-subdomain.conf;
  }
  </code></pre>
  
  <p>tnanks,
  D</p>