Helicity of membrane proteins can be manifested inside the ribosome tunnel, but the determinants of compact structure formation inside the tunnel are largely unexplored. Using an extended nascent peptide as a molecular tape measure of the ribosomal tunnel, we have previously demonstrated helix formation inside the tunnel. Here, we introduce a series of consecutive polyalanines into different regions of the tape measure to monitor the formation of compact structure in the nascent peptide. We find that the formation of compact structure of the polyalanine sequence depends on its location. Calculation of free energies for the equilibria between folded and unfolded nascent peptides in different regions of the tunnel shows that there are zones of secondary structure formation inside the ribosomal exit tunnel. These zones may have an active role in nascent-chain compaction.