The Talmud in Shabbos (22a) says:
אמר רבה נר חנוכה מצוה להניחה בטפח הסמוכה לפתח והיכא מנח ליה רב אחא בריה דרבא אמר מימין רב שמואל מדפתי אמר משמאל והילכתא משמאל כדי שתהא נר חנוכה משמאל ומזוזה מימין
Rabbah said: The Hanukkah lamp should be placed within the handbreadth nearest the door. And where is it placed? — R. Aha son of Raba said: On the right hand side: R. Samuel of Difti said: On the left hand side. And the law is, on the left, so that the Hanukkah lamp shall be on the left and the mezuzah on the right.
From the Talmud is clear that the best place to light the Chanukia is by the door. But what door are we referring to? In Talmudic times people generally lived in houses with front gardens, and this Gemara is referring to the door which connects the garden to the street,that is, the garden door. That was the best place to publicize the miracle of Hanukka to the passerbyes. In addition to this, when lighting by the door you have on one side a Mezuza and in the other the Hanukka candles and that's something desirable. The Meiri explains why:
ותהא נר חנוכת משמאלופירושו בתגדת ויבא בעל הבית בתפליו ובטלית מצוייצת ביניהםחונה מלאך ה׳ סביב ליראיו ויחלצם
The Hanukka candles should be placed in the left and the Haggada explains that by doing this, the man will come to the door with his Tallit and Tefillin in between them (Hanukka candles and Mezuza), in accordance to the Pasuk "Hashem places his angel around those who fear him".
So in other words, the point is to be surrounded by Mitzvot - Mezuza, Hanukka candles, Tefillin and Tallit.
The Masechet Sofrim , a much earlier work, puts it differently:
Unlike the Meiri, this explanation is more obscure and difficult to understand. How is this verse connected to placing the Mezuza at the right and candles at the left?
Be it as it may, this custom of lighting the Hanukka candles at the door fell in disuse in the last centuries. As people moved to the cities and colder climates, it was quite difficult and often times impossible to light at the door facing the street. The vast majority of people today don't have garden doors as they either live in apartments or in houses that have no front gardens. In addition to that, at many points in history Jews felt uncomfortable publicizing the Mitzva because of anti-semitism concerns, so the custom became to light inside the house either by the window or hidden somewhere in the house (in case of fear of persecution).
In some cases, lighting by the window is also not a good alternative- for example, nobody will see the Hanukiot at the windows of a high penthouse apartment. In these cases, you should light by any door of your house (preferably the most used door) in order to light the candles next to the Mezuza as mentioned in the Talmud.
In Israel today, there's a widespread initiative to light by the door at the streets once again, as it's fairly common there to have garden doors and there's no fear of anti-semitism. So as you can see, there are many opinions and different possibilities in choosing where to light your candles. I hope I helped you find the right one! Happy Hanukka