Yes, they can be replaced in engine bay, but exhaust manifold bolts can be hard to remove because they rust in place
6 bolts/studs on each side, see if you can break all 6 on each side free, without stripping heads, don't remove yet just try each one to get it moving
If one or two(or more) won't budge then I would consider taking it to an independent Exhaust Shop, they will often work for CASH, lol, and they have all the tools and know-how to get exhaust bolts out and will have any new bolts needed on the shelf
If you can get them all loose then remove them and remember where each one goes, they are different lengths
Clean off any old gasket debris
Clean bolts/threads with wire brush, put "anti-seize" on threads before re-installing
Some exhaust gaskets come with two slotted bolt holes, like this:
https://www.ebay.ca/itm/185313078050?hash=item2b25852b22:g:c6EAAOSwDW1iGEi6&fits=Year:1992|Model:Ranger|Make:Ford
Picture is of exhaust gaskets upside down
Point of the slotted holes is so you can install those end bolts loosely and lower the gasket down between head and manifold, and it will be held in place by those 2 bolts
Then you can install the other 4 bolts and tighten them up, start in center and go out to each end
If an exhaust gasket has a metallic side, most do, it faces out so its the exhaust manifold side