title: How to split a nginx virtual host (config) file into small ones using shell
body: <p>I have a nginx server and it has around 30+ virtual host block in a single file. 
  All the virtual host block go like that:</p>
  
  <pre><code>    server
         {
      #concrete configuration items
      server_name    myserver.hostname.com;
      #concrete configuration items
      #and so on....
  
      }
  </code></pre>
  
  <p>My question is how can I split every server block into a single file named by server_name value? for example the above server block save to a file named myserver.hostname.com.conf
  I would like to use shell code to complete this task.</p>
  
  <p>By the way, I not sure whether it is a good idea to make every virtual host has its config file.But I did thing as virtual host increasing it became a messy to stuck them all in a common file.</p>