19th century China was not a place that was freely open to visitors from the western world, but that didn’t stop the outside forces from breaching into China to establish their peddling ways. What they failed to realise however is that the Chinese had their own secret weapon, the flaming monkeys.
In the 1820's, China was being ruled by the Qing dynasty, at a time when the Chinese nation was not dependent on foreign trade at all, and was for the most part closed off from foreigners. Britain had control of neighbouring India at the time, and were keen to import their Indian-made products into China for commercial trade. They were keen on importing opium in particular, which they grew in their Indian colony.
At the time China was heavily opposed to the British importing Opium into their country, and took measures to stem the trade (after all, who wants a flowing drug trade) . The British had been illegally importing Opium into China for some time, which it was bringing in from its Indian colony. By the late 1830's, opium use was rife in mainland China, and so the Chinese set about destroying 1,400 tons of British opium that was being stored in Canton.
A few days later after the opium destruction, a couple of drunken British sailors killed a local Chinese man, but the British refused to the turn the sailors over to the Chinese. A couple of months after the incident, several British warships arrived in Chinese waters, and destroyed a Chinese controlled blockade near Hong Kong. The British fleet continued up river towards Canton and stayed there.
Several months later negotiations with the Chinese had broken down, it was at this time the British attacked and occupied Canton. Over the next year the British continued to engage Chinese port forces and continued to be successful. In early 1842, the Chinese did mount some resistance (a last stand of sorts), and unveiled their cunning plan to take back their port city. The Chinese had planned to tie fireworks to the backs of monkeys and hurl the flaming monkeys at the British, all in a bid to cause confusion among the British sailors on their ships. It came to not much avail, and the British held out, and by August they had captured Nanjing.
With the fall and capture of Nanjing, the Chinese were beaten and overwhelmed, and moved to sign a peace accord with the British (The Treaty of Nanjing), which was heavily worded in Britain's favour. As a result of the treaty, China had to pay war reparations to Britain, and they also had to give Hong Kong to Britain. They also had to open up an additional four ports (including Shanghai), to foreign trade. British citizens were also granted the right to not be tried under Chinese law for any crime.
All was quiet on the Eastern front for a while, but tensions flared up once again in the 1850's when Chinese officials boarded the British ship (Arrow) to arrest several of the Chinese crew (and lowered the British flag while they were there). The British responded by sending a warship back to Canton where they commenced bombardment of the port, and fighting once again ensued between Chinese and British troops on the shore. With trading in the port suspended, the Chinese went about burning down all foreign (especially British) factories and warehouses in Canton, which enraged the British.
Britain's fleet arrived back in Canton in 1857 (as they were preoccupied with the Indian colony mutiny in the preceding years). The French Navy (who had their own grievances with Chinese trading), had also arrived along with the British. They took Canton with relative ease and had taken Tianjin once again by April 1858. The Chinese were once again forced back into negotiations, which resulted in further ports being opened to foreign trade and established foreigners rights to travel within China. Later that year opium importation was legalised in China.
When the British returned to Tianjin in 1859 to sign the treaties, they came under fire from the Chinese. The British took heavy losses, and with the Chinese now refusing to sign the treaties, war broke out again.
The following year a large contingent of British and French support vessels arrived, they proceeded to take Tianjin and within a month they had also taken Beijing, burning the Chinese Emperor's summer palace to the ground.
The Chinese were beaten and forced to sign the original two treaties as well as finally giving Hong Kong to Britain (which Britain retained until 1997).