From left, Apollo 1 astronauts Virgil I. "Gus" Grissom, Edward White and Roger Chaffee pose in front of their Saturn 1 launch vehicle at Launch Complex 34 at the Kennedy Space Center. The astronauts later died in a fire on the pad.

NASA's first major disaster, the Apollo 1 fire that killed three astronauts 45 years ago today, marked a dark day for the space agency. But it also marked the beginning of NASA's continual process of learning from its own mistakes.

And what a costly mistake it was. On Jan. 27, 1967, Virgil 'Gus' Grissom, Edward White and Roger Chaffee, the first crew of America's manned moon program, Apollo, were suited up and strapped inside their new space capsule for a dress rehearsal of their upcoming launch — a mission to fly the Apollo capsule to Earth orbit to test the vehicle for moon flights. This was to be a ground test only, and wasn't thought to pose much risk.

But when an electrical spark ignited a fire, flames and smoke swept through the capsule, and the crew was unable to escape. An investigation later was unable to pinpoint the exact initiation spot of the fire, but determined that the plethora of flammable materials (especially Velcro) and pure oxygen environment inside the capsule were partly to blame.

In the 45 years since that day, spacecraft builders have learned a lot about constructing safer space vehicles. [Photos: The Apollo 1 Fire]

"From a human safety perspective, I think because of the shock that the industry went through following the Apollo 1 fire, I think they set a great foundation and since the recovery from Apollo 1 I think people have been able to make good refinements," said Bill Johns, chief engineer at Lockheed Martin for the Orion capsule, NASA's next-generation spaceship being designed to carry astronauts to deep space.

Examining the evidence

The fact that the disaster occurred on the ground rather than in space made a big difference to those hoping to understand what went wrong, and do better next time. In this case, all the evidence was sitting there waiting to be examined, which would have been impossible for an accident after launch.

One of the most incriminating finds made by the investigation team was that the 100-percent oxygen environment of the capsule, originally intended to reduce the weight of the vehicle, made fire extremely easy to start.

NASA soon put a stop to that, and redesigned Apollo to fly with a mix of about 34 percent oxygen in its pressurized modules.

"The biggest single change that they made, and they made it phenomenally within the next year, was that they had to go from pure oxygen environment to an air environment," Johns told SPACE.com. "Materials exposed to pure oxygen are just looking for an excuse to burn." [Infographic: How the Apollo 1 Fire Happened]

In addition to changing the mix of gas in the cabin, engineers had had to redesign many aspects of the vehicle to accommodate the change, including making the spacecraft's walls significantly thicker to handle the increased pressure.

Fire safety lessons

Another major finding was that the prevalence of flammable materials inside the Apollo 1 cabin further increased the risk of fire.

After the accident, NASA reduced the amount of flammable Velcro in the crew cabin, and tested many of the capsule's materials for flammability.

Now, as a result of the lessons learned from Apollo 1, many new materials have been developed for spaceflight with fire safety in mind. The insulation surrounding wires, for instance, is now made of a special coating so fire-resistant that it can't burn even when put in a pure oxygen environment.

Lockheed Martin engineers test emergency escape procedures from NASA's new Orion capsule at the the Exploration Development Lab in Houston. (Image credit: Lockheed Martin)

The hatch

A particularly tragic aspect of the Apollo 1 fire was the fact that the astronauts inside the capsule tried to open the hatch to escape, but couldn't.

The investigation later revealed that the hatch opening procedures were way too difficult and took too long to be executed in an emergency. Furthermore, the inward-opening hatch was impossible to open under any pressure higher than normal atmospheric pressure — and the fire had boosted the cabin pressure significantly.

Ironically, NASA had considered installing explosive bolts on the hatch for emergency openings, but opted against it out of fear that the door might open accidentally, putting the astronauts at risk. (The hatch had prematurely opened on Grissom's previous Mercury flight, when his Liberty Bell 7 landed in the ocean).

However, after the fire crew capsule hatches were significantly redesigned. NASA changed Apollo's hatch to an outward-opening design, and that same choice persists today in Orion.

"It's the minimum entry — if you want to deal with carrying humans to space, you need to have a hatch that opens outward so that the crew has a chance to open it," Johns said. "Those rules have carried forth to this day."

Additionally, the Orion capsule includes an alternate escape option through the docking hatch, and an explosive system to blow out the hatch in an emergency.

Ultimately, though, while spacecraft safety has improved leaps and bounds since Apollo 1, the business of flying in space is still risky, and NASA aims to remember that. The Apollo 1 fire was not the last of NASA's deadly space accidents. Two fatal space shuttle accidents, one in 1986 and the other in 2003, killed 14 astronauts in all, forcing NASA each time to reexamine its spacecraft safety.

"In the face of our greatest accomplishments, it's easy to lose sight of the fact that each time men and women board a spacecraft, their actions carry great risks, along with the opportunity for great discoveries and the chance to push the envelope of our human achievement," NASA administrator Charles Bolden said in a video message to commemorate the Apollo 1 anniversary this week. "In memory of our colleagues I ask all of you in the NASA family once again to always make your opinions known and be unafraid to speak up to those in authority so that safety can always be our guiding principle and the sacrifices of our friends and colleagues will not have been in vain."

You can follow SPACE.com assistant managing editor Clara Moskowitz on Twitter @ClaraMoskowitz. Follow SPACE.com for the latest in space science and exploration news on Twitter @Spacedotcom and on Facebook.