* Attacks targeting fans have killed 20 in past weeks
* Shutdown comes a day before World Cup opening ceremony
* Nigeria, Kenya, Uganda issue alerts over viewing centres (Adds security order in Abuja)
YOLA, Nigeria, June 11 Soldiers in a Nigerian state at the heart of an Islamist revolt shut down all venues preparing to screen live World Cup matches on Wednesday, hoping to stave off the kind of attacks that have killed more than 20 people in the past two weeks.
The Nigerian government also advised residents of Abuja to avoid public viewing centres as the 2014 World cup kicks off in Brazil in case of attacks.
Nigeria has seen an increasingly bold series of assaults over the past five years by the Islamist militant group Boko Haram, including the kidnapping of more than 200 schoolgirls in April.
Since then, militants have set off a car bomb that killed 18 people watching a game on television at a centre in the settlement of Gavan, in the northeastern state of Adamawa, on June 1.
A week before, a suicide bomber set out for an open-air screening of a match in Nigeria's central city of Jos. His car blew up on the way, killing three people.
Such assaults on often-ramshackle television viewing centres across Africa have raised fears militant groups will target supporters gathering to cheer on the global soccer contest.
"Our action is not to stop Nigerians ... watching the World Cup. It is to protect their lives," Brigadier-General Nicholas Rogers said on Wednesday in Yola, the capital of Adamawa state, which has been hit regularly by Boko Haram raids.
Many fans had been relying on the viewing centres - often open-sided structures with televisions set up in shops and side streets - to watch live coverage of their national squad, the "Super Eagles" - seen by many as Africa's main champion in the contest.
Minister Bala Mohamed issued a directive for Abuju ordering high vigilance in places such as motor parks, restaurants, markets, supermarkets, shopping malls, banks, churches, mosques, hotels, viewing centres and hospitals.
"Apart from installing separate close circuit televisions (CCTVs), they are required to liaise with appropriate security agencies and engage well trained uniformed security personnel who shall be equipped with bomb detectors," the minister said.
The shutdown in the impoverished regional state bordering Cameroon came a day before the tournament's opening ceremony and first match between Brazil and Croatia.
But vegetable-seller Mary Toba said she welcomed the decision, especially after the Gavan blast.
"I had told my husband and children they would have to kill me before I let them go out to watch football. I have dreams about the danger ... I thank the military for their action," she told Reuters.
Boko Haram - whose name roughly translates as "Western education is sinful" - has declared war on all signs of what it sees as corrupting Western influence.
Security experts have said the viewing centres' combination of soccer and, sometimes, alcohol made them a target.
Authorities have issued warnings about going to the venues in Kenya, Nigeria, and in Uganda, where memories are still fresh of bomb attacks on two centres that killed at least 74 people watching the last World Cup final. (Reporting by Emmanuel Ande; additional reporting by Mike Edebor in Abuja; Writing by Andrew Heavens; Editing by Andrew Roche and Ralph Boulton)