The Gemara in Shabbos 21b teaches that the mitzva of lighting candles is to light them in the entrance of the house – in the doorway.

Rashi says that even in a house with a courtyard or driveway, one lights at the front door of his house, not the courtyard. Tosfos comments that a courtyard with two gates needs two menorahs. One at each gate – seemingly not at the ‘front doorway’ at all.

But the Gemara said ‘פתח’ – door, so although Tosfos say that the mitzva has nothing to do with a door, he also says that only in a house with no courtyard would one light at the door.

What’s is the basic logic that led Rashi and Tosfos to such opposite ideas?
They were arguing what the focal point of the statement in the Gemara was: Was it חוץ (outside), to accomplish the mitzvah of publicising the miracle as the key goal or בית (the house) to accomplish להדליק as the key goal.

So according to Rashi you should light inside a house as the primary mitzva, but lighting at the door satisfies the secondary mitzva of publicising the event.
Tosfos is of the opposite opinion in both aspects. The primary function of lighting a menora is to publicise the event – and as such Tosfos says that one should light as close to the public as possible, and the בית aspect is secondary.

The Beis Halevi asks: According to the respective views regarding the meaning of ‘פתח’ – do you light inside of door, or outside?
Again Rashi and Tosfos have opposite opinions:
Tosfos says that it means inside of the courtyard door while Rashi says it means outside of the front door.
Their reasoning being as follows:

Rashi says that lighting inside a house is not public at all, thereby serving a house’s primary function, but if so then there is no Pirsumei Nisa; to achieve this, lighting must be done outside.
Tosfos says that it needs to be inside the courtyard, as an outside courtyard is the public domain. It also needs to be connected in some way to the בית the Gemara referenced, and be lit on private property.

The Pri Chadash asks a new question: What if a house has a door and a window, and the house has no courtyard – where would one light their menora?
Yet again Rashi and Tosfos have converse opinions. According to Tosfos you do it at the window which is following the idea of Pirsumei Nisa as a window is more public than at the door. However, Rashi uses the idea of בית and says it should be by the door.

Next question: What would happen if one lit in the courtyard of their house? – Tosfos says that one has fulfilled the mitzva l’chatchila (the way it’s meant to be), whereas Rashi says one would not be fulfilling the mitzva at all.

There are 2 ברכות – להדליק נר (the Bracha on the mitzva to light), and שעשה ניסים לאבותינו (the Bracha commemorating the miracle).
In conclusion there are two concepts: First, lighting like they lit. With the lighting, we commemorate the chanukas habayis (re-inauguration event) of removing the impure foreign elements from the Beis Hamikdash, Second, is remembering the great miracle.
The miracle is a symbol of the Yom Tov’s historical re-inauguration event, but the main goal was lighting the Menora itself.

The question is asked: Was it, in fact, the lighting or was lighting the Menora special because of the miracle that occurred, demonstrating G-D’s valuation of our actions?

If we follow Rashi’s reasoning, the primary mitzva is commemorating the re-inauguration, and the main goal is ‘להדליק נר של חנוכה’ in your house and to light inside. Publicizing the miracle and the miracle itself is only a symbol of the main event of inauguration and as such Pirsumei Nisa is secondary to the mitzvah of actually lighting the Menorah.

If we follow Tosfos’s reasoning, the miracle was the main event of Chanuka – the re-inauguration – so publicising is essential, and done as closely as possible to the public domain. There was a secondary part that the miracle itself came about through the lighting of the menora, so we satisfy that aspect of it and light a menora too.