States and cities throughout the nation severely restricted their nightlife on Sunday — closing bars, restaurants and clubs or cutting hours — in drastic measures intended to fight the coronavirus and certain to wreak economic havoc.

In Boston, the mayor shut down all beer gardens and asked nightlife venues to close by 11 p.m., not long before the governor of Massachusetts announced that restaurants would be allowed to serve food only by takeout or delivery. In Chicago, establishments with liquor licenses were told to limit capacity to 100 people and prevent people from forming lines outside — an instruction rendered moot mere hours later, when Gov. J.B. Pritzker (D) shuttered all bars and restaurants in Illinois through March.

Ohio Gov. Mike DeWine (R) ordered that all bars and restaurants in his state be shut down effective at 9 p.m. Sunday. “We’re two days from St. Patrick’s Day, when people get together and crowd into bars,” he said. “We are at a crucial, crucial stage.”

DeWine said he had no idea how long the shutdown would last, saying: “It will be in effect as long as it needs to.”

The closures come amid reports and photos on social media of revelers packing bars and restaurants across the country over the weekend, despite increasingly dire warnings from officials that people should stay at home. Federal health authorities have recommended that Americans practice “social distancing” — avoiding crowded places, working from home and generally keeping inside.

Health officials also have pointed to Italy as a warning. Many Italians flouted the calls to stay home once work and school were canceled — and, on Sunday, their country announced a 25 percent one-day spike in its death toll from the virus. The number of active cases in Italy had been rising almost 20 percent daily.

In California, Gov. Gavin Newsom (D) held a news conference Sunday to urge bars, nightclubs and brewpubs to close — though he said it was not a legal order. He also asked that restaurants practice “deep social distancing,” including reducing occupancy by half.

The sweeping closures leave business owners and employees in the country in a predicament without precedent in recent memory. In announcing Ohio’s closures, DeWine sought to throw his state’s workers a lifeline: He said he hoped restaurants and bars would stay open to offer delivery and takeout options.

Still, DeWine acknowledged that the closings would probably devastate small-business owners and their staffs. He apologized for the suffering he was about to inflict but insisted that he had to act now to ensure that Ohio’s health-care system does not break down under the pressure of accepting an ever-rising tally of coronavirus patients.