IDG Location: Dedicated pad on the accessory gearbox
If it's gonna be coaxial, the only place is the rear (it will be
burnt) or the front (it will get in the way of intake).
That's a good question and remark. Actually the generator (integrated drive generator or IDG) is off engine axis and goes on the corresponding IDG drive pad of the accessory gearbox (AGB).
The accessory gearbox is a gear train with multiple teethed wheels enclosed in a housing, located at the bottom of the fan case, or on its side when the engine nacelle would be too close to the ground. AGB for the CFM56-7B (Boeing 737 NG):

CFM56-7B AGB located on the side of the fan frame. Source.
Same engine, with accessories in place:

Accessories in place (NTSB inspection after fatal accident). Source.
The IDG is visible below the starter (the large cylinder with its long vertical bleed air pipe), identifiable by its 3 colored phase connections and wires also running vertically to the pylon connectors).
How is AGB driven by the engine?
Does the generator spin from the LP turbine or the HP one
HP (N2) shaft. I believe the first reason to do this is because the AGB is also used to start the engine, and the starter must drive the high pressure compressor rather than the booster.
If it's gonna be coupled to a gear...
Yes there are several gears in the way.
On the CFM56-7B engine, the N2 shaft speed is about 14,400 rpm, but the fuel pump works at 6,000 rpm, the IDG is more efficient at 8,000 and the hydraulic pump operates at 4,000. The purpose of the three gearboxes and the gear train in the AGB is to provide individual accessories with a support and a shaft at the desired rpm.
The wheels in the AGB are driven by the high pressure shaft (N2) using the inlet gearbox (IGB) located near the N2 shaft within the fan frame hub. Internal configuration, same engine:

How is the AGB driven by the engine high pressure shaft
The gearbox on N2 (inlet gearbox or IGB) rotates a radial shaft.
The radial shaft, which runs within one of the fan frame struts to cross both the core airflow and the fan airflow, drives a second gearbox located outside of the engine, attached to the fan frame case
The second right-angle gearbox (transfer gearbox or TGB) drives a horizontal shaft which itself drives the AGB gear train.
The AGB provides the drive pads with their shaft.
Same accessory gearbox with related components, ready to be driven by N2 shaft:

CFM56-7B AGB with its TGB and radial shaft. Source.
Allocation of dedicated pads on the AGB

Accessory pads on the CFM56-7B AGB. Source: CFM56-7B Engine Manual
AGB variations
Each engine has a different, but similar accessory gearbox. Another example:

AGB on a Rolls-Royce engine. Source.
Two electric generators actually and possibly the starter used as a generator
Note that on both AGB, there are two electric generators:
One is the smaller engine electrical generator (control alternator on the first AGB) which is used by the engine itself to feed its own electric equipment (notably the FADEC/EEC which controls the engine). This generator takes over the aicraft electrical supply (IDG) as soon as the engine is started (after the speed has reached 15% N1). The engine will continue to run in the event of aircraft electrical failure.
The other is the larger IDG, the main source of electric power for the aircraft.
The starter is another accessory. When starting the engine, the radial driving shaft is used in the other direction, the accessory box drives the engine shaft. Sometimes the starter and the generator are a single component, an electric motor being reversible. See How is a turbine engine rotated for starting and inspections?