NATO forces have bombed the compound of Libya's embattled ruler Muammar Gaddafi in the Libyan capital, Tripoli, as opposition fighters are closing in on the city.