Before you build a portal there is a web.config file that is copied into the root of the virtual directory at creation time.
Stored here
C:Program FilesCommon FilesMicrosoft Sharedweb server extensions60CONFIG
It merges other config files into the final one if they are named correctly notice the
webconfig.sps.xml
This is merged in at creation time.
As per MSDN