On this page of the Valheim guide, you will learn how to create an indoor fire.
In Valheim, characters can go to bed to receive the Rested bonus. However, the bed must be near a campfire. A quick solution to this problem, especially at the beginning of the game, is to put a campfire right behind the wall where the bed is and build a roof above the hearth to protect it from the rain. However, there are many ways of having a campfire inside your shelter that will allow the smoke to go outside.
First, select a site and prepare the ground for the hearth. Make sure there is enough room above the hearth so you can build around it.
Build around the hearth as you see fit. In this particular case, we used straight walls and one beam on the left side to create a little clearance at the bottom.
If you want, you can put a cooking station over the hearth so you can prepare meat without having to go outside.
Go outside and build the chimney above the building's roof level, then put up a canopy to protect the hearth from the rain. The smoke coming out of the fireplace will rise up and go out through the opening.