How do NSAID's work and what are the differnces between COX-1 and COX-2?
NSAIDs work by inhibiting COX-1 and/or COX-2. These are the key enzymes in prostaglandin biosynthesis. Prostaglandins act as messenger molecules in the process of inflammation and therefore can cause pain and other inflammatory symptoms. Source

COX-1 is normally present in different tissues of the human body and is for example important for maintaining the stomach lining. By contrast COX-2 mediated prostaglandin synthesis is only induced by injuries and inflammation. The analgesic effect of NSAIDs is therefore mainly based on the inhibition of COX-2. 

There are to different classes of NSAIDs, non-selective (aspirin, naproxen, ibuprofen, ...) and COX-2 selective (celecoxib, parecoxib, ...-coxib). Due to the different roles of COX-1 and COX-2 these different drug classes have different adverse effects and differ in their analgesic effect depending on the dose. E.g. use of aspirin can lead to ulcers of the stomach or duodenum while COX-2 selective drugs do not cause gastric problems (but others).