How does the same linux server build an online environment and a test environment?

  linux, question

How does the same linux server build an online environment and a test environment?
Is the code uploaded to the test environment, test no problem after the file to the online environment

Different branches are established for online and testing respectively, and then tools are used to synchronize to the formal environment of testing or.