(written from a Production point of view)
Canon is a sanctioned or accepted group or body of related works. The Star Trek canon is generally defined as all released television series and feature films. The various "official" references (such as the Star Trek Encyclopedia or the Star Trek Chronology) may be used as a guide to canon information, but are not canon in and of themselves.
The definition of Star Trek canon may vary for different fans, and therefore for a reference source like Memory Alpha, the question may become especially difficult. The term fanon is used to refer to "fan canon", of which the term is a portmanteau. It applies to certain "facts" that may have been accepted as a truth by a large number of fans, and thus either replaces an established canonical fact in the minds of those fans, becoming retroactive continuity, or fills a plot-hole.
The history of defining canon Edit
In 1988, Paramount Pictures removed Star Trek: The Animated Series (aired 1973–1974) from canon. However, the definition of Star Trek canon as encompassing all released TV series and films has been generally accepted since TAS was first released on DVD; the studio officially changed its removal of TAS from canon by listing the animated series as a part of established canon in its database at StarTrek.com.  wbm wbm wbm
'Canon' in the sense that I use it is a very important tool. It only gets muddled when people try to incorporate licensed products into 'canon' – and I know a lot of the fans really like to do that. Sorry, guys – not trying to rain on your parade. There's a lot of bickering about it among fans, but in its purest sense, it's really pretty simple: Canon is Star Trek continuity as presented on TV and Movie screens. Licensed products like books and comics aren't part of that continuity, so they aren’t canon. And that's that. Part of my job in licensing is to keep track of TV and Movie continuity, so I can help direct licensees in their creation of licensed products. It gets a little tricky because it's constantly evolving, and over the years, Star Trek's various producers and scriptwriters haven't always kept track of/remembered/cared about what's come before.
A large body of licensed Star Trek works exists that, while approved for publication by Paramount, are not considered part of Star Trek canon. This includes novels, comics, games, and older reference books such as the Star Fleet Technical Manual. It is in this regard that Memory Alpha allows the term "Apocrypha" as a heading for an appendices section to separate, truncated only, information derived from these works from both the in-universe sections as well as the valid production background information sections.
Note that, over the years, background information from non-canon works has worked its way into canon Star Trek. These include the first names of Hikaru Sulu and Nyota Uhura, for example. Remastered Star Trek also added further examples, such as the design of the non-canon 23rd century Starbase 47 being used for Starbase 6.
There is a large body of non-canon unlicensed work produced by amateur filmmakers. CBS Studios supports and encourages the creation of fan fiction and released a set of guidelines to avoid the licenser's objection against fan produced Star Trek films. 
The recent growth of episodes and films produced by former Star Trek cast and crew has garnered much greater attention than traditional fan fiction. The projects that fall into this group include:
- Star Trek: New Voyages
- Star Trek: Of Gods and Men
- Star Trek: Axanar
- Star Trek Continues
- Star Trek: Renegades
It is these projects, in particular, that have come under intense scrutiny from CBS with its new rules as the producers of both Anaxar  and Renegades  experienced to their detriment in 2015 and 2016 respectvely.
The participation of former Star Trek staff and the increasing production value sophistication of these projects notwithstanding, Memory Alpha consider these productions as fan-produced, therefore remaining outside the purview of this wiki.