I really wouldn't recommend commuting for that length of time unless it is completely necessary, speaking as a commuter student.
Also consider- is that the true length of your full commute? It's easy to look at e.g. your train trip length and say "ok this is X amount of time, that seems reasonable". But you also need to factor in how long it takes you to get to and from the train station, if there are any additional public transit forms used which could be a liability in case of e.g. delays, cancellations, strikes, and you also need to consider the timetables - it's unlikely they will match up perfectly and even if they did you almost certainly would want to build in some buffer time in case of delays. If you're driving, you then need to factor in traffic conditions and how these vary at different times of day, and think about how you would get there if there is disruption on your route (e.g. road closures etc).
For example, on paper my train trip for my commute is 1 hour 15 minutes, which doesn't seem to bad. However, it takes me ~20-25 minutes to walk to the station from home, then once I arrive at my destination, I need to spend 5 minutes walking to get the next public transit link, 10 minutes on that, then another 10 minutes walking on the other end. Plus, the timings of things means that I realistically have to arrive on campus at least 30 minutes before my lectures, in order to avoid risking having only a couple of minutes to get somewhere and risk being late if there are any delays. It's really draining and I spend a huge amount of my week now commuting - which I only do because it's literally financially impossible for me not to where my uni is (London...).
And that's just from a practical/wellbeing perspective! That doesn't even account for that fact that due to this lead time, I'm sort of psychologically discouraged from picking option modules with early start times as I'd need to get the train around 6 then, and for modules that finish later (e.g. after 4) this time to get back combined with hitting the rush hour heading back makes that unappealing as well. Equally, it means I'm very much not keen to stay on campus into the late afternoon/evening (when many societies hold events and meetings). I also generally spend less time on campus as I spend so much of it commuting, and so spend less time getting to know the people on my course. These things are, for me, not a dealbreaker - but especially if you're going to uni for the first time (particularly as a school leaver), they are probably much bigger factors.
Additionally, you should carefully look at the costs of it. In some situations it may work out cheaper (variable depending how much you value the hours you spend commuting vs not though), but in general commuting is expensive and so the relative savings of living further away may be ameliorated by the increased costs of commuting.
It's possible (I mean I'm doing it!) but in most situations not advisable in my opinion - if you don't have specific family/caring/financial/professional obligations that necessitate it, it's probably not worthwhile.