Saturday, June 29, 2013

Bitcoin Millionaires

Every time you spend bitcoins to buy a drink at Evr, a swanky bar in midtown Manhattan that accepts the digital currency, you make its co-owner, Charlie Shrem, just a little bit richer.


And that’s not only because a chamomile sour costs $17 (or 0.16 bitcoins). It’s because whenever someone new uses bitcoins, the electronic currency’s value tends to increase. Shrem has bought thousands of bitcoins for about $20 each, starting in 2011. Since then, the digital coins have soared in value to $109.


That’s turned the 23-year-old into a millionaire and into one of a handful of early bitcoin investors who’ve decided to sink their windfalls back into the bitcoin economy, starting their own companies and investing in others.



“Infrastructure is what we need,” says Shrem. “We’ve gotta build, build, build–financial software, exchanges, and different payment products.” In addition to his investment in the bar, Shrem founded Bitinstant, a company that makes it possible to buy bitcoins at Kmart and 7-Eleven, and is a member of BitAngels, an investment group created this year to help Bitcoin startups evolve from garage operations into real companies.


Bitcoin angels like Shrem don’t have pockets nearly as deep as entrepreneur-turned-investors who’ve made it big in Silicon Valley—some of whom, like Steve Case and Vinod Khosla, have net worth in excess of $1 billion. But their influence is substantial. As conventional investors begin to show interest in Bitcoin startups, it is small-time tycoons like Shrem who are acting as gatekeepers and ambassadors.


“The early guys are the ones that run everything,” says Shrem. “In this space, how long you’ve been around matters.”


Bitcoin originated in 2009, when its source code was posted online by persons unknown. Despite its mysterious origins, the way it works is transparent: the currency is produced when people carry out difficult cryptographic operations on computers, and then it’s exchanged over an open-source peer-to-peer network. Bitcoins are immune to counterfeiting and don’t rely on any central authority.


Initially, Bitcoin was mostly a curiosity. Among the first businesses to accept it were gambling sites, narcotics delivery services, and a farm selling alpaca socks. Yet Shrem and others have been thinking strategically, creating companies that comply with the law with the intention of making Bitcoin a widely used form of money.



One reason to do so is that the number of bitcoins is limited: there’s a theoretical maximum of 21 million, of which 11.3 have been “mined” so far (see “Custom Chips Could Be Shovels in Bitcoin Gold Rush”). That means the more people buy and use bitcoins, the more they tend to be worth. Anthony Gallippi, CEO of Bitpay, an Atlanta company that helps online stores accept payment in bitcoins, says one reason early buyers are reinvesting in the technology is to “ensure future returns” on the currency’s value.


“You didn’t get that dynamic in the dot-com days,” says Gallippi, who claims that he and business partner Stephen Pair are sitting on “thousands” of bitcoins they purchased for $1 or $2. He reasons that anyone who now buys even one bitcoin is in effect betting “on the whole space.”


The easy windfalls earned by Bitcoin’s early promoters are attracting interest from mainstream venture capitalists. In May, Shrem’s company received $1.5 million from the investment firm of the Winklevoss twins (who famously sued Mark Zuckerberg over the idea behind Facebook). Also last month, the venture fund operated by Peter Thiel, Facebook’s first major investor, invested $3 million in Gallippi’s company.


Those deals have been important endorsements for the online currency (see “Big-Name Investors Back Effort to Build a Better Bitcoin”). Yet what they mean for the philosophy at the heart of Bitcoin isn’t as clear, says Roger Ver, an important early investor.The 34-year-old electronics entrepreneur says he sank his life savings into the currency and has used the gains to invest more than $1 million in more than a dozen Bitcoin startups, including Shrem’s. “The typical investment size has been around $100K USD,” Ver wrote in an e-mail from Tokyo, where he lives. “I’m motivated by the positive ways in which Bitcoin use being widespread will make the world a better place.”



Like many early enthusiasts, Ver, who once ran for the California senate and later spent 10 months in prison for selling fireworks on eBay, was attracted to Bitcoin because of his libertarian, antigovernment views. He believes such currencies, if they replaced national ones, could make it impossible for governments to “finance their wars” by printing money.



Bitcoin Millionaires

Bitcoin is on the money

Digital currencies are a threat to current financial systems, say Alec Ross and Jonathan Luff.


Around the world, governments everywhere are trying to come to terms with technology. Some are finding the pace of change too fast and the flow of information too free for their autocratic hierarchies, and they risk being swept away.



In the US and the UK, attempts to generate efficiencies and drive wider social benefits from digital technology have delivered uneven results. There is tension between the proponents of technology-driven change and those who seek to uphold long-established legal, economic and social structures, as witnessed in the arguments over intellectual property between the tech giants and the creative industries, and the heated debate over the surveillance of electronic communications. It is clear that policymakers and those who advise them do not have a satisfactory conceptual framework for dealing with the disruptive impact of technology on society.

At the G8 meeting in Northern Ireland last week, the focus was on three Ts: Trade, Tax and Transparency. The aim was to boost the global economy while responding to popular concern about the ways in which large corporations and wealthy individuals have used technology-driven globalisation to minimise taxes. This is an important agenda for taxpayers, and progress is being made.



Largely unnoticed, an interesting advert appeared in a handbook accompanying the G8, placed by a company that was until recently known only to a small number of technology entrepreneurs and early adopters. The advertiser was Mt Gox, a marketplace for trading BitCoin, a digital currency. The message was that with more than 7,500 legitimate businesses using a single BitCoin payment processor (BitPay), digital currencies have arrived, and existing currencies and regulators had better take note. And so they should, because the technology that powers digital currencies like BitCoin presents a challenge to those, such as the G8 governments, currently exercising sovereignty over our societies.

BitCoin itself is a peer-to-peer digital currency which, unlike the currencies found in virtual worlds such as Second Life’s “Linden Dollars”, can be used to purchase real-world as well as online goods and services. The people who created BitCoin remain something of a mystery, but its innovative peer-to-peer structure and the sophistication of its code has helped establish it as the leader in this field.


source: http://www.telegraph.co.uk/finance/currency/10139651/Why-Bitcoin-is-on-the-money.html



Bitcoin is on the money

Battle Over Bitcoin

Seven months ago, Fred Ehrsam pitched his bitcoin-based startup Coinbase to more than a dozen Silicon Valley investors.


Although those potential backers were known for being forward-thinking — and they had a lot of money to invest in high-tech ventures — Ehrsam got more than a few blank stares. He spent more of his time explaining the concept of peer-to-peer currency, which is emerging as the world’s default platform for digital money, than describing his plans for the company itself. So he and his co-founders turned to the Chinese, specifically, to IDG Ventures. To the Beijing-based venture capitalists, the PayPal-like service for buying, selling and accepting bitcoins was a perfect fit.



“They said, ‘We’re sold on digital currency; we just want to know if you’re the right people,’” Ehrsam told International Business Times as he paced a San Francisco rooftop terrace on a recent windy afternoon. “It was a very different starting point.”


Indeed, virtual currencies are nothing new to the Chinese. For example, more than 100 million people on the social platform QQ have used the Q coin for more than 10 years. And after China’s state-run China Central Television, or CCTV, ran a half-hour-long documentary on bitcoins, downloads of apps for processing and “mining” bitcoins soared in the world’s second-largest economy.


Bitcoin, long the plaything of the Western uber-nerd, now appears poised to grow substantially in China and other markets, like the euro zone, where government meddling in native currency valuations has left many distrustful of the money in their bank accounts.


Americans don’t have this problem — yet. And that may be a problem in itself. According to bitcoin proponents, if the U.S. tries to ignore the nascent currency, writing it off as a financial fad with less value than the seemingly stable dollar, Americans risk ceding to the Chinese and others control of the future of what could be the most disruptive force in monetary exchanges since the credit card. In turn, the dollar and the ability of the U.S. to navigate global currency conflicts could be seriously weakened.


“Here’s the bottom line: Bitcoin has much higher popularity outside the U.S. and much higher potential outside the U.S.,” observed Andreas M. Antonopoulos, of the Bitcoin Foundation. “If you go to an American and say, ‘Hey, there’s this new thing, bitcoin, they say, ‘Well, what’s wrong with the dollar?’ That question is different in other countries.”


Bitcoins are a finite, Web-based currency created in 2009 by a group of hackers working under the nom de Internet Satoshi Nakamoto. Exactly 10,952,975 bitcoins are in circulation, all of which have been purchased on exchange networks or mined. The currency is mined using software that processes transactions on the bitcoin network, adding groups of transactions, called blocks, to the chain. Miners are paid about 25 bitcoins per block. That digital money can then be used to purchase a variety of goods online, from legitimate software to heroin on the infamous virtual black-market Silk Road.


Bitcoin surged in value to $266 last month, thrusting the currency into the mainstream spotlight as investment poured in from sources as diverse as the hapless Brothers Winklevoss (of Facebook infamy) and Union Capital Ventures principal Fred Wilson (an early investor in Zynga, Twitter and Kickstarter). Suddenly, everyone was talking about buying bitcoins. But the bubble burst in late April, and in the U.S. at least, bitcoin faded from the news. That was not the case in China, where Antonopoulos said downloads of bitcoin clients have eclipsed those in the U.S.


Bitcoins are mined in several steps. After downloading a bitcoin client, such as Coinbase (which serves as a wallet in which to store the bits of code that constitute the digital money), miners often join pools where they share computing power to decode algorithms in which bitcoins are hidden. The concept of bitcoins and bitcoin mining is cryptic for many people, even some otherwise forward-thinking American investors. The irony is that, for now, American startups are leading the bitcoin charge, and the U.S. government was the first to issue guidance on using the currency as payment — a seemingly tacit recognition of bitcoin’s validity as legal tender.


Why China Poses A Threat


Feng Li, the IDG partner who chose to fund Coinbase, said the Chinese have yearned for access to a virtual currency since the central government cracked down on the use of Q coins.


Q coins were introduced in March 2002 by Tencent Holdings Ltd. (HKG:0700), the parent company of the country’s most popular instant-messaging service, QQ, and they currently average an annual transaction value of more than 1 billion yuan ($163 million). That value is growing at a rate of about 15 percent to 25 percent a year.


Q coins, purchased with yuan, are predominantly used to buy virtual products and services in QQ and its related online games and social media. Originally, Tencent regulations prevented Q coins from being traded between users or converted back to yuan but allowed users to trade points and purchase Q coins with their game accounts, then use the black market to convert them into cash. That caused concerns at the People’s Bank of China, China’s central bank. In January 2007, converting game points to Q coins was banned, and Tencent reiterated that Q coins constitute a product, not a currency, which seemed to satisfy the concerns.


“There has already been proof with the Q coin,” Feng said of the Chinese likeliness to start using bitcoin. “It’s been very well circulated and very well adopted.”


Already, shops on Taobao — the Chinese equivalent to eBay Inc. (Nasdaq:EBAY), owned by Alibaba.com Ltd. (HKG:1688) — accept bitcoins as payment for goods, as does the similar service, Tencent’s PaiPai.com.


The Chinese are embracing bitcoins in other ways. The first bitcoin fund began to raise money in June, with the goal of raising 20 million yuan. The fund’s investment threshold is 10,000 yuan, and it will mature in four years.


Q coin’s popularity isn’t the only reason bitcoin has appeal in China. As it turns out, China is the perfect place for bitcoin mining. While much of the developed world is well into the transition from personal computers to mobile devices, China’s PC market is still thriving, which provides the necessary computing power to run a successful business converting electricity into mined coins. Price caps on electricity already create wasteful use of energy in China, so running a code-crunching computer for hours on end isn’t as costly an investment as it would be in the U.S. And so-called gold-mining or gold-farming businesses already exist in China’s cybersphere. None of that will come as a surprise to any “World of Warcraft” player: Gamers in Chinese urban sweatshops are known to sit in front of glowing blue screens for hours, slaughtering players in the game for their spoils or mining gold deposits found in the sprawling milieu of Blizzard Entertainment’s international blockbuster. Those treasures are then sold to players in the game for real money.


China has a heavily controlled currency, which also makes bitcoin attractive.


“The more controlled the currency is, the harder the transactions are, the more friction there is in the national currency, the more appealing the coin is,” Antonopoulos said, noted that the most appealing place to use bitcoin would be a country whose economy is a veritable train wreck — like Zimbabwe, except that the southern African nation lacks the necessary technology. “I would say China is perfect,” he said. “It’s got the penetration, it’s got the smartphones, it’s got the Internet and the people are familiar with virtual currencies. And, it’s got the not-as-appealing national currency.”


Regulation In The U.S.


Guidance issued in March by the U.S. Treasury Department said that companies issuing or exchanging online cash, including bitcoin, would be subject to the same scrutiny as traditional firms such as the Western Union Co. (NYSE:WU) to prevent money laundering.


Less than two months later, the Department of Homeland Security proved that edict had teeth.


Federal officials obtained a warrant Tuesday to seize an account tied to Mt.Gox, the Tokyo-based exchange company that handles about 80 percent of all bitcoin trades. Authorities accused Mt.Gox’s U.S. subsidiary, Mutum Sigillum LLC, of failing to register as a money-services company with the Treasury’s Financial Crimes Enforcement Network. An account held by the online-payments firm Dwolla was subsequently seized.


Many feared the warrant execution could cast a chill over the bitcoin industry as a sector centered on a borderless, decentralized money came under the scrutiny of the federal government.


That proved not to be the case, Coinbase’s Ehrsam said. “For bitcoin to go mainstream, or as it goes mainstream, it will be used in a higher and higher amount of transactions,” he said, adding that Coinbase is registered as a money-services firm. “There’s no way there will be all this money flowing through an unregulated system.”


Chris Larsen — the CEO of OpenCoin, a fellow San Francisco-based payment platform that processes most national currencies as well as bitcoin and its own virtual cash, Ripple — agreed. “They definitely are regulating them, [and] we actually think that’s a really good thing for the industry,” he told IBTimes. “I thought the guidance was a good idea. One of the things the guidelines seem to make clear for the first time is that a virtual currency could be used for goods and services.”


The Price Of Regulation


But such regulation is a slippery slope, said Jerry Brito, a senior research fellow at the Mercatus Center at George Mason University.


Perhaps it begins with measures to prevent money-laundering, he said. But what measures would the government take to prevent the untraceable currency from being used for child pornography or human trafficking?


“Bitcoin has the potential to be a disruptive technology that would be beneficial to the economy, and we don’t want to kill off that potential to get at the other potential for bad stuff,” he observed. Brito, who plans to speak next month at a conference on virtual currencies organized by the National Center for Missing and Exploited Children, added: “We’re already the first country to enforce money-laundering laws against bitcoin. But the U.S. would be shooting itself in the foot if it went too far [with regulations] and either outlawed bitcoin or made the legal guidelines impossible to comply with.”



Will China Step In?


So far, Chinese bitcoin merchants have little to fear. For many, the CCTV segment on bitcoin seemed to be a signal from Beijing, which heavily controls the channel’s content, that the currency is worth exploring.


Some of those interviewed speculated that the Communist Party wants to see bitcoin stockpiled in China, allowing the government to invest in it if, or when, the dollar is shaken from its perch as the world’s reserve currency.


It remains to be seen whether — or, more likely, when — China will intervene in the trade of bitcoin in its own economy. But for the U.S. to experience widespread adoption of the currency, which is considered a necessary step for gaining a grasp on the bitcoin market, limited government control will have to allow the money, like the Internet that birthed it, to develop organically.



Battle Over Bitcoin

Bitcoin Exchange Makes Apparent Move

WASHINGTON—The world’s largest bitcoin trading exchange appears to have taken a key step to comply with U.S. anti-money-laundering rules and potentially avoid additional run-ins with authorities.



A company listed as Mt. Gox this week registered as a money services business with the Treasury Department’s Financial Crimes Enforcement Network, according to FinCen’s website. Tokyo-based Mt. Gox, which says it handles about 80% of all trading in the virtual currency, couldn’t immediately be reached for comment.



FinCen in March started applying traditional money-laundering rules to “virtual currencies” amid growing concern that new forms of digital cash are being used for illicit activities. Those rules mandate that exchanges register with FinCen, follow stricter bookkeeping requirements and report transactions of more than $10,000.


About a month after the edict, the Department of Homeland Security seized an account tied to Mt. Gox, alleging the company and a subsidiary were conducting transactions “as part of an unlicensed money service business.”


According to FinCen’s website, the agency received Mt. Gox’s registration on Thursday. The online form listed a street in Dover, Del., as the company’s address.


A spokesman for FinCen had no comment on the development. Earlier this month, FinCen’s director, Jennifer Shasky Calvery, said that “those offering virtual currencies must comply with…regulatory requirements, and if they do so, they have nothing to fear from Treasury.”


Mt. Gox’s move may bring the company in line with Treasury’s rules, but could also open the exchange to increased regulatory attention.


“It gives them the color of legitimacy,” said Mercedes Kelley Tunstall, a partner with the law firm Ballard Spahr LLP, who works on banking compliance issues. “It suggests that they get it, that they need to be careful in these areas. It also means that now they have put themselves on the radar screen and they need to have policies and procedures to watch out for fraudulent activity and illegal activity.”


Mt. Gox already had taken measures to beef up its identification procedures for users who deposit or withdraw traditional currencies, a central tenet of anti-money-laundering procedures. In May the company said all user accounts must be verified in order to perform any fiat currency deposits or withdrawals. Verification includes submission of a valid photo ID and proof of residence such as a utility bill or tax return, according to the website.



At the time, Mt. Gox said it had more than doubled its verification support staff.


More recently, Mt. Gox halted U.S. dollar withdrawals. The company said it needed to make systems improvements amid increased trading volume.


The recent regulatory attention paid to bitcoin-related companies has likely caused some banks to become leery of doing business with such companies, attorneys have said.


But becoming registered with FinCen or state agencies that have requirements for money transmitters may not make financial institutions more comfortable working with such firms, Ms. Tunstall said.


“I think that the virtual currency industry still needs to mature before banks will feel comfortable with them,” she said.


The rising popularity of virtual currencies, while no more than a drop in the bucket of global liquidity, is being fueled by Internet merchants, as well as user concerns about privacy and jitters about traditional currencies in Europe.


source: http://stream.wsj.com/story/latest-headlines/SS-2-63399/SS-2-265472/



Bitcoin Exchange Makes Apparent Move

Tuesday, June 18, 2013

Free Feathercoin Sites List

Here is a list of websites that offers free Feathercoins. Some of them, you just need to enter your Feathercoin address and you’ll receive free Feathercoins, and on other sites you need to preform tasks to earn Feathercoins.


A new currency based on litecoin has gained more traction in two weeks than its predecessor did in a year.

Feathercoin lets cryptocurrency miners generate a new coin that’s very similar to Litecoin, but with far less difficulty.


Feathercoin Faucet – current payout is 0.5 FC. Payout will happen when there are at least 100 submitted!




 


 FCKamikaze – nice betting game – Free icon smile Free Feathercoin Sites List




Free Feathercoin Sites List

Free Litecoin Sites List

Here is a list of websites that offers free litecoins. Some of them, you just need to enter your litecoin address and you’ll receive free litecoins, and on other sites you need to preform tasks to earn litecoins.



Can Has Litecoin (TK) – they say they are out of Litecoins but it looks like it still works.



GetFreeLTC - currently offering a daily payout of 0.01 LTC per day.


GetFreeLiteCoins - very similar to the above one - 0.01 LTC per day.


Litecoiner - cummulation bonus.



This is Bitcoin faucet but i was told its Litecoin.
banner1 Free Litecoin Sites List



Free Litecoin Sites List

Sunday, June 16, 2013

Free Bitcoin Sites List

List of sites to earn free Bitcoins


Here is a list of websites that offers free bitcoins. Some of them, you just need to enter your bitcoin address and you’ll receive free bitcoins, and on other sites you need to preform tasks to earn bitcoins.



Free-Bitcoins (SE)


Daily Bitcoins – free 0.00001 bitcoins every hour just enter your wallet address and solve a captcha. Payouts only when 0.0001 collected.


BTC4you - Bitcoins every 30 minutes.


BTCflow - Daily payments, up to 1800 satoshis and sometimes even more.


Free Bitcoin Lottery - Play bitcoin lottery for free.


BitcoinSpain - You can earn more bitcoins every 30 minutes.


BITCOINFOREST - Free 0.00001 bitcoins every day.


GreenCoins - Get a lot of flowers for free every half hour to generate a green and beautiful garden in your wallet.


Red Coins - One request per hour, Weekly payments , 54.3 uBTC min. payout.


Raw Bitcoins - Get Free Bitcoins every 30 minutes.


Sr Bitcoin (SP)


FreeBitcoins - Everything about bitcoin.


The Bitcoin - Largest amount of the internet, every 30 minutes.


BITCOIN FAUCET - You get 150 satoshi (1.5 μBTC) for each valid, unique user.


Bitcoiner - Prize multiplier.


Coinreaper


BitcoinAR (AR) – Get Free Bitcoins


Cointicket - Get free bitcoins every day.


El Bitcoin Gratis (SP)


FaucetBTC - Get free bitcoins every 30 minutes.


Bitcoin Addict


 


View websites and earn coins



Earn Free Bitcoins - EarnFreeBitcoins.com is a website in which you earn small amounts of Bitcoins in exchange for visiting websites for a designated period of time. You may be required to spend anywhere from one minute, up to five minutes or more on the sponsored website. You must spend the full amount of required time on the website in order to recieve payment.


BitVisitor



 


View videos and earn coins



CoinTube


 



Free Bitcoin Sites List

Saturday, June 15, 2013

The Bank Job 2008

The Bank Job 2008




The Bank Job 2008

Money as Debt 1 (Full Movie)

“Money is a new form of slavery, and distinguishable from the old simply by the fact that it is impersonal, there is no human relation between master and slave.” –Tolstoy


Debt- government, corporate and household has reached astronomical proportions. Where does all this money come from? How could there BE that much money to lend? The answer is…there isn’t. Today, MONEY IS DEBT. If there were NO DEBT there would be NO MONEY. If this is puzzling to you, you are not alone. Very few people understand, even though all of us are affected.




Money as Debt 1 (Full Movie)

Bitcoin - An Analysis

Bitcoin is the first distributed, digital currency. It received a lot of attention recently as it questions the state monopoly to issue legal tender. It relies on distributed proof-of-work concepts to ensure money-like characteristics.


The existence and potential widespread use of such a distributed, non-centralized, non-regulated currency questions the ability of governments to control money supply, issue debt, and tax its populace.


Transactions in bitcoin form a publicly accessible network of economic relations, which can be extracted from the transaction history available to all users in the P2P-network of bitcoin.


Using re-identification algorithms it is possible to attack the proposed anonymity of users. While this is already an interesting security issue, the insight into a real-world economic experiment allows for the first time the empirical test of community structures in such social networks, which is definitely more substantial than the “I-like”-network in facebook and the like.


In this presentation, we show results on network analysis of the money flow, the behavior of individuals, and the overall scalability of P2P-currencies. At the same time we will discuss advanced “financial instruments” that one might find in the transactions.


Speaker: Kay Hamacher, Stefan Katzenbeisser

EventID: 4746

Event: 28th Chaos Communication Congress (28C3) by the Chaos Computer Club [CCC]

Location: Berlin Congress Center [bcc]; Alexanderstr. 11; 10178 Berlin; Germany

Language: english

Start: 29.12.2011 14:00:00 +01:00




Bitcoin - An Analysis

Bitcoin Hackathon Berlin

The event was a great success with tons of great conversations and ideas. Also we got our hands dirty to actually implement stuff.




Bitcoin Hackathon Berlin

Bitcoin will continue to function

When talking about the online currency Bitcoin – a currency backed not by any nation state, but instead a series of mathematical rules – coverage tends to focus either on the surging value of each coin (currently about $130 or £85) or the fact that Bitcoins are quite a handy way to buy drugs online, using the Silk Road website.


Both are of interest, but are roughly akin to focusing on how the aeroplane might disrupt the hot-air balloon industry: it’s true, but drastically misses the true potential of an innovation to change the world – for good or for ill.


The real transformative power of Bitcoin, or something like it, lies not in a speculative bubble, but in its potential to put currency outside of the control of governments, or law enforcement agencies.


What that could mean has been brought to light by a massive international investigation into a different online currency, Liberty Reserve, which now stands accused of involvement in a $6bn money laundering scheme.


Liberty Reserve, which operated out of Costa Rica, was a centralised “gateway” currency, making transactions hard to trace. People needed to provide only minimal details – name, email, address and date of birth – to open an account, making it an easy way to make money traces disappear.


In pre-prepared remarks, Preet Bharara, the US attorney for the southern district of New York, described the site in damning terms.


“The only liberty that Liberty Reserve gave many of its users was the freedom to commit crimes, as it became a popular hub for fraudsters, hackers, and traffickers,” he said. “And the global enforcement action we announce today is an important step towards reining in the wild west of illicit internet banking. As detailed in the indictment, Liberty Reserve was intentionally created and structured to facilitate criminal activity. It was essentially a black market bank.”



Law enforcement has finally caught up to the weakest link in the maze of virtual back streets, false-facers and more: the trail of money. Trying to trace a hack is often almost impossible, but trying to follow where – say – stolen money goes is far more doable.


That’s not an easy task – securing the Liberty Reserve indictment took 17 law enforcement agencies. But given the extensive record-keeping in traditional banking, regulations around moving money across borders, and more, chasing the cash is a far easier task than trying to follow sophisticated online operators with experience of covering their tracks.


Unless, of course, some unknown genius (or group of clever people) invents a currency that so far lies beyond such regulations, is to all intents and purposes untraceable, and doesn’t require even the minimal information requested by Liberty Reserve.


Or, in other words, something exactly like Bitcoin.


Bitcoin makes Liberty Reserve look quaint – as unlike the alleged money launderer, Bitcoin is decentralised. There’s no single company or entity controlling the currency, and so it’s nearly impossible to shut down.


Where real money is exchanged into Bitcoins is still a potential weak spot for authorities – and some Bitcoin exchanges are looking to sign up with regulators – but given that an exchange could operate with almost any currency from almost anywhere in the world, stopping all of them would be no simple matter.


Bitcoin is vulnerable in lots of ways: attacks on the major exchanges shake people’s faith in the currency. Major sell-offs could cause collapse. The central infrastructure is creaking, and so could perhaps be pushed over the edge.


But Bitcoin itself is almost irrelevant: it could well overcome its current challenges and gain stability and scale. But if not, it’s provided the world a large-scale demonstration of what a decentralised currency could do.


If Bitcoin, or a currency working in a similar way to it, got a stable value and a large user base, it could take cash flows forever out of the hands of government. Whether that’s a great thing or a terrible thing depends on what you’re trying to do, what you think of government and what country you’re talking about.


Giving pro-democracy activists operating in countries run by autocratic regimes a way to receive funding and operate more effectively is something most of us would approve of. Allowing terrorists or criminal gangs to do the same in our home country is something we’d likely oppose. But it’s the same technology that facilitates both.


The prosecutors of the southern district of New York are very publicly celebrating their shutting down of the Liberty Reserve operation. They should enjoy it – it may be one of their last such victories.



Bitcoin will continue to function

How Bitcoin Is Sacrificing Its Soul to Survive

It’s been a wild couple months for digital currencies. This past week saw the bust of Liberty Reserve for its alleged role in billions of dollars of illicit transactions, and two days later the largest bitcoin exchange said it would now require all accounts to be verified.


For the digital currency to survive, must it sacrifice its soul? Can it thrive if it does?


To be sure, there are important differences between bitcoin and Liberty Reserve. Where Liberty was effectively a black box for transactions, controlled by a single entity, bitcoins are traded on a peer-to-peer network independent of any central authority. (Bitcoin did have its own law-enforcement episode on May 17, when the Department of Homeland Security froze the accounts of two U.S.-based bitcoin processors. The alleged misdeed: failing to properly register.)

In the Liberty Reserve case, the illegalities were brash, according to U.S. officials. One million users across the world—one-fifth of them Americans—made 55 million transactions over seven years to the tune of $6 billion, with few questions asked while Costa Rica-based Liberty collected 1 percent, investigators said. The network is thought to have been employed in the $45 million ATM heist for which eight people were arrested in May.


Chicago-based investment fraud attorney Andrew Stoltmann said bitcoin holders should be spooked, because the digital exchanges have been used by criminals for money laundering as well.

But Peter Vessenes, chairman and executive director of the Bitcoin Foundation, was unfazed by the Liberty Reserve crackdown.


“The U.S. put out guidance recently through the Financial Crimes Enforcement Network, and we’ve been following up on that guidance and crushing bad actors,” he said in an interview with CNBC Asia. “We’re seeing a bit of a sweep right now,” he said.


“There’s nothing to indicate that good players who are working hard to stay regulated have anything to worry about.”


And there’s the rub: The techno-libertarian fantasy of an unfettered digital currency is losing its veil of anonymity and is dependent upon ensuring the appeasement of government regulators. It’s enough to make a cryptotarian anarchist blanch.



However, bitcoin holders also seem to have taken the Liberty Reserve bust mostly in stride; trading volume surged significantly on the news, but nowhere near the mid-April levels when bitcoin exchange rates swung by hundreds of dollars in a few hours, after the Cyprus financial crisis shook faith in banking institutions and made bitcoin an overnight sensation. The exchange rate, while volatile by currency standards, has steadied between $100 and $140 for most of the time since that dust settled, and was around $128 Friday, just 6 percent off May highs, according to data on bitcoincharts.com.

“The $64 billion question is: Are these new safeguards window dressing, or will they effectively handle the problems?” asked Stoltmann. “It’s such a new phenomenon, we just don’t know.”


A truly transparent bitcoin market, with a spotlight on the identity of all transactors, would seemingly be of little interest to criminals. But then, who does want that? At a time when people are increasingly wary of stores and websites collecting their personal information, Vessenes says it’s on the consumer to scrutinize the party on the other end of a transaction, and to be suspicious if they don’t want to pry.


“As a consumer, I stay away from companies that have questionable know-your-customer policies,” he said. “They’re suspiciously light on how much information they want about you.”


So if anonymity is gone and a hypervigilance about identity sharing is required or advisable, what is bitcoin’s remaining appeal?

For one, as a currency of limited quantity—about half of the 22 million bitcoins that can ultimately be “mined” through complicated computer data crunching are currently on the market—it is appealing as a hedge against inflation, said Tyler Moore, a Southern Methodist University computer science professor who has studied bitcoin exchanges. On the other hand, when holders become convinced that value is bound to rise, they tend to hoard their treasure.


Moore, who has studied hacker breaches of bitcoin accounts, notes that a downside of the digital currency is that having no central governing authority for a currency means having no recourse when one’s account is raided.


He sees a regulated bitcoin as a feasible, if ironic, solution to keeping the currency viable, given the exchanges cooperate. And then, he says, “criminals will shift to a currency the authorities aren’t keeping a close eye on.”


source: http://www.cnbc.com/id/100774151



How Bitcoin Is Sacrificing Its Soul to Survive

Bitcoin's In Danger From The Bureaucracy

I’ve long been less than enthusiastic about the future prospects of Bitcoin.


I simply don’t think that it’s offering something important enough for people to change their ways to use it. Others differ: which is fine, it would be a very boring world if we all agreed all the time. However, I’m increasingly seeing what I take to be a large and present danger to Bitcoin, the bureaucracy. Here’s just today’s example:



With mounting pressure on online money exchanges from US regulators, payments processor OKPay has announced that it is suspending processing for all Bitcoin exchanges, including industry leader Mt. Gox.


Dwolla has already stopped processing payments going into the Bitcoin ecosystem. There are many other stories about smaller Bitcoin organisations finding themselves suddenly unbanked: banks simply insisting that they do not wish to provide them with accounts any more.


In order to succeed, in the sense of becoming a widely used medium of exchange, Bitcoin needs to be convertible into something else. It could of course simply be into commodities, but it would have to be generally and widely accepted for that to be sufficient. In the absence of half the stores on the planet taking it that means that Bitcoin must be convertible into fiat currency: pounds, dollars and euros etc. And that means that there has to be some entrance into the current international financial system: which is where I see the problem as lying.


Almost anyone at all in that international financial system has a connection into the US one. And if the US bureaucracy that oversees that US financial system decides that it doesn’t like people who deal with Bitcoin, or even doesn’t like people who deal with people who deal with Bitcoin, then Bitcoin just won’t have access to the international financial system. It’s not a matter of pure legality either. Bitcoin itself certainly isn’t illegal, paying for something with it isn’t, changing $ into $B isn’t and so on. But there are enough regulations about who may do what with whom in the financial system that any determined bureaucracy can freeze someone out of it.


As, for example, happened with Wikileaks. It’s not a coincidence that the world’s banks slowly stopped being willing to process donations to Wikileaks. It wasn’t as crude as “What a nice US bank you’ve got here, be a shame if something happened to it” but it doesn’t need to be that crude. Just the merest hint that there might be more audits than usual would be enough to steer a bank away from handling Bitcoin (or Wikileaks) transactions. And look where the Wikileaks matter ended up: at one point the only way you could donate was through Bitcoin (or physically travelling with cash).


Now, I don’t know that the US bureaucracy has it in for Bitcoin: but that is the way I’m beginning to read these various refusals and withdrawals of banking services. Pressure is being put on people not to handle the currency. I think that this means that it will fail.


On the other hand, Bitcoin boosters should be rather happy about my gloom. They’ve been telling us all along that Bitcoin doesn’t actually need all the rest of the financial system: it’s so good that it will be able to replace it. Great eh? Looks like we might find out whether it can.


source: http://www.forbes.com/sites/timworstall/2013/05/29/bitcoins-in-danger-from-the-bureaucracy/



Bitcoin's In Danger From The Bureaucracy

The First Real Threat to Bitcoin?

For most Bitcoiners, it is a well known fact that there is a significant risk in the decentralized peer-to-peer currency pertaining to hashing power.


In order to maintain a perfectly democratic internet currency, no one single entity should ever have control of 51%, or greater, of the total network hashing power.



Today, one of our researchers discovered that according to Blockchain.INFO, a miner at 85.214.124.168 currently has approximately 15% of the total hashing power. This, in itself, is every day news. However, the strange or even frightening fact is that it is producing empty blocks (single transaction blocks). If this 15% turned into 51%, it could have the potential to kill bitcoin. Why are they doing this? There are a few possible reasons:


1. The entity may have discovered a method for increasing mining ROI, and essentially, is earning its 50 bitcoins per block much more quickly than others. In general when finding a block, hashes for every transaction must be computed. When computing 1 transaction per block versus 100, you can imagine the latter would be more costly than the former. However, this means that the entity would not receive any fees for processing transactions. It is difficult, at the current time, to determine whether this would be beneficial.


2. The entity is willing to blow money on mining these empty blocks. Essentially, this could lead to a complete stop in bitcoin transaction processing. If the entity obtains 51% of hashing power and fully stops processing transactions while mining against only its own blocks, the block chain will become useless. Some people who might do this include governments, banks, competing currencies, or ridiculously wealthy and bored individuals who have a vendetta against bitcoin.


3. This could also be a botnet that does not wish to deal with the hassle of constantly sending all of the current transaction information to its zombies. This would be more for coding simplicity rather than for financial gain.


As of today, there is still very little risk. Additionally, assuming this entity falls under the #1 listed above (i.e., not entirely malicious), the worst thing that will happen is that bitcoin transaction confirmations will be slowed down by whatever percent of hashing power they are “contributing,” and Jerry McGuire will yell “SHOW ME THE MONEY!”


So what is it? Is this entity generously increasing their ROI, or is it attacking and taking over? With the recent security advisories and, of course, the widely publicized hacks, it looks like the WWW (Wild Wild West) is in full effect.


source: https://www.privateinternetaccess.com/blog/2012/03/bitcoin-war-the-first-real-threat-to-bitcoin/



The First Real Threat to Bitcoin?

Drupal - Creating Pages & Menu Items

In this video I am going to show you how easy this is to do using the Drupal Content Management System.




Drupal - Creating Pages & Menu Items

Drupal 6 - Basic SEO Tutorial

A tutorial on how to manage the basics of SEO on your Drupal based website.




Drupal 6 - Basic SEO Tutorial

How to setup nodes and blocks

Drupal 6 – How to setup nodes and blocks


In this tutorial video you’ll learn how to setup nodes and blocks in Drupal.




How to setup nodes and blocks

Drupal 6 Content Profile Module Tutorial

Drupal 6 Content Profile Module Tutorial




Drupal 6 Content Profile Module Tutorial

Drupal 6 Review Site The Modules

Activating the modules for creating a Drupal 6 Review Site. Setting up an admin user and setting permissions.




Drupal 6 Review Site The Modules

Drupal 6 Simple Views Slideshow Setup In Aquia Marina

Create a slideshow with drupal 6 “Views” and “Views Slideshow” in Aquia Marina or for that case any other theme modules.


style.css add the following


/* Views Slideshow Styling

For the most part it will get it’s styling from the theme

the only one you may need to add is the height and width style to

stop it from bouncing the theme up and down as different size

content fills it. Hence the need to control the content.

*/


/* CHANGE THE myslideshow to what ever your slideshow is called.

*/


/* Set the size of the slideshow box :

Its important if you have content with long and short text

if you don’t set this your views-slide show will get bigger and smaller

as it auto fits the text. For styling this can make it consistent

*/

#block-views-myslideshow-block_1 {height: 200px;width: 300px;}


/* OPTIONAL STYLING

*/


/* Styling the title

*/

#block-views-myslideshow-block_1 .views-field-title a{font-weight: bold; text-decoration: none;}


/* styling the body

*/

#block-views-myslideshow-block_1 .views-field-body {font-size: 14px;}


/* styling the number pager at the bottom

*/


/* This is the whole pager

*/

#views_myslideshow_singleframe_pager_1 {background-color: #666666;}


/* This is just the active number

*/

#block-views-myslideshow-block_1 .activeSlide{background-color: #000000;}




Drupal 6 Simple Views Slideshow Setup In Aquia Marina

Drupal 6 Views Carousel

On this week’s Mustardseed Media Podcast, Bob shows off another module commissioned by Mustardseed, the Views Carousel Module for Drupal 6 (and Views 2).


This module is a cool way to spice up your site without having to write any custom javascript.




Drupal 6 Views Carousel

Drupal 6 Views Introduction

This is an introduction to the views module in Drupal 6.




Drupal 6 Views Introduction

Thursday, June 13, 2013

Backing up your Drupal site

Backing up your Drupal site with the DEMO MODULE




Backing up your Drupal site

Begin Learning Drupal - Step by Step

Drupal is not as hard as it looks. I’m a Drupal Design Developer that currently teaches Drupal in my spare time to business owners that have no programming or design experience.


I have helped them use Drupal the easy way. So I figured why not put these videos online.

If you have a specific Drupal question, or would like to know something about Drupal that bugs you and you need some guidance, let me know.




Begin Learning Drupal - Step by Step

Create a Drupal Development Environment (Part 1)

Setup a VirtualBox Virtual Machine using Ubuntu 10.4 lts server in order to host your own Drupal Development Environment.




Create a Drupal Development Environment (Part 1)

Create a Drupal Development Environment (Part 2)

Setup a VirtualBox Virtual Machine using Ubuntu 10.4 lts server in order to host your own Drupal Development Environment.


The second installment takes you from a blinking linux curser through installing all the required packages and applications for a drupal environment.




Create a Drupal Development Environment (Part 2)

Create a Drupal Development Environment (Part 3)

Setup a VirtualBox Virtual Machine using Ubuntu 10.4 lts server in order to host your own Drupal Development Environment.


The third installment goes through installing Drush and using drush to install drupal onto the server VM.




Create a Drupal Development Environment (Part 3)

Creating a webform in Drupal

More Drupal Tips @ http://www.gaslampmedia.com – In this tutorial, we show you how to set up and configure your first webform, complete with your own custom fields.


Perfect guide for a contact form or questionnaire you may want on your Drupal website.




Creating a webform in Drupal

Deploying Drupal with Web Platform Installer

This is the first webcasts of a series on deploying, managing and configuring Drupal and other PHP applications on the Windows Platforms.




Deploying Drupal with Web Platform Installer

Wednesday, June 12, 2013

WordPress on Apache and Nginx

This is one of good config i found and made working, if you find any idea how to improve this let me know.

Its mainly for WordPress with W3 cache, running on Apache2 and served using Nginx as reverse proxy

with fastcgi for php handling. The reverse cache system is good for handling of static data.

But i think it can be used also for Joomla or Drupal.

Static web would run very nice with this config.


#YourSite is configAlias,


server {

listen 80;

server_name www.sitename.com;

rewrite ^/(.*) http://subdomain.sitename.com/$1 permanent;

}


server {

listen 80;

server_name www.sitename.com *.sitename.com;

access_log off;

error_log off;


# Main site domain


root /var/www/siteroot;

index index.php index.html index.htm;

error_page 404 = @YourSite;

log_not_found off;


#location / {

# try_files $uri $uri/ /index.php?$args;

#}


rewrite /wp-admin$ $scheme://$host$uri/ permanent;


location ~* \.(jpg|png|gif|jpeg|css|js|mp3|wav|swf|mov|doc|pdf|xls|ppt|docx|pptx|xlsx|ico)$ {

# Cache static-looking files for 120 minutes, setting a 10 day expiry time in the HTTP header,

# whether logged in or not (may be too heavy-handed).

proxy_cache_valid 200 120m;

expires 864000;

proxy_pass http://www.sitename.com:8080;

proxy_cache one;

}


location ~* \/[^\/]+\/(feed|\.xml)\/? {

# Cache RSS looking feeds for 45 minutes unless logged in.

if ($http_cookie ~* “comment_author_|wordpress_(?!test_cookie)|wp-postpass_” ) {

set $do_not_cache 1;

}


proxy_cache_key “$scheme://$host$request_uri $do_not_cache”;

proxy_cache_valid 200 45m;

proxy_cache one;

proxy_pass http://www.sitename.com:8080;

}


location = /50x.html {

root /var/www/siteroot;

}


# No access to .htaccess files.

location ~ /\.ht {

deny all;

}


############## WP SUPER CACHE ############


if (-f $request_filename) {

#expires max;

break;

}


if (-d $request_filename) {

break;

}

set $supercache_file ”;

set $supercache_uri $request_uri;


if ($request_method = POST) {

set $supercache_uri ”;

}


if ($query_string) {

set $supercache_uri ”;

}


if ($http_cookie ~* “comment_author_|wordpress|wp-postpass_” ) {

set $supercache_uri ”;

}


if ($supercache_uri ~ ^(.+)$) {

set $supercache_file /wp-content/cache/supercache/$http_host/$1index.html;

}


if (-f $document_root$supercache_file) {

rewrite ^(.*)$ $supercache_file break;

}

############## WP SUPER CACHE ############


location ~ \.php$ {

fastcgi_pass 127.0.0.1:port;

fastcgi_index index.php;

include /etc/nginx/fastcgi_params;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

}


location @YourSite {

proxy_set_header Host $host;

# Set the real IP.

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_pass http://www.sitename.com:8080;

}


location / {

# If logged in, don’t cache.

if ($http_cookie ~* “comment_author_|wordpress_(?!test_cookie)|wp-postpass_” ) {

set $do_not_cache 1;

}


proxy_cache_key “$scheme://$host$request_uri $do_not_cache”;

proxy_cache one;

proxy_pass http://www.sitename.com:8080;

}


location ~* wp\-.*\.php|wp\-admin {

# Don’t static file cache admin-looking things.

proxy_pass http://www.sitename.com:8080;

}


location ~ \.php$ {

try_files $uri @YourSite;

proxy_set_header Host $host;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_pass http://www.sitename.com:8080;

}

}



WordPress on Apache and Nginx

FreeBSD: Nginx Virtual Hosting Configuration

Nginx name-based virtual hosting configurations


You need to create directory structure as follows to host more than two websites under same IP address:


a] /websites : Host each domain under this directory. You need to create dirs as follows:


  1. /websites/examples.com/http - Html / php / wordpress / forums files for example.com goes here.

  2. /websites/examples.com/logs - Log files for example.com goes here.

  3. /websites/examples.com/stats - awstats stats files for example.com goes here.

 



 


 


b] /usr/local/etc/nginx/vhosts: Host each domains configuration under this directory.


Your sample setup


  1. IP address: 202.54.1.2

  2. HTTP Port: 80

  3. Domain1 : theos.in hosted at /websites/theos.in/http

  4. Domain2 : cyberciti.biz hosted at /websites/cyberciti.biz/http

Create necessary directories


Type the following commands:
# D=/websites

# NROOT=/usr/local/etc/nginx

# mkdir $D

# mkdir $NROOT/vhosts

# mkdir /var/log/nginx/

# chown root:www /var/log/nginx/


Create / update default cache all ngnix config file


Open /usr/local/etc/nginx/nginx.conf file, enter:
# vi /usr/local/etc/nginx/nginx.conf

Update it as follows:


user www www;
worker_processes 1;
 
# main server error log
error_log /var/log/nginx/error.log ;
pid /var/run/nginx.pid;
 
events {
worker_connections 1024;
}
 
# main server config
http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] $request '
'"$status" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
 
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
gzip on;
 
# default server for ip 202.54.1.2
server {
listen 202.54.1.2:80 default;
server_name _;
access_log /var/log/nginx/access.log main;
server_name_in_redirect off;
location / {
index index.html;
root /usr/local/www/nginx;
}
}
 
# virtual hosting
include /usr/local/etc/nginx/vhosts/*;
}

Where,


  • user www www; :: Setup user and group name for Nginx server.

  • worker_processes 1; :: nginx has the ability to use more than one worker process for large systems such as SMP system with tons of ram.

  • error_log /var/log/nginx/error.log ; :: Default error log file.

  • pid /var/run/nginx.pid; :: Default PID file.

  • include mime.types; :: Set Multipurpose Internet Mail Extensions (MIME) for www communication from mime.types files.

  • default_type application/octet-stream; :: Set default header media type of the message content

  • log_format main ‘$remote_addr – $remote_user [$time_local] $request ‘

    ‘”$status” $body_bytes_sent “$http_referer” ‘

    ‘”$http_user_agent” “$http_x_forwarded_for”‘;
     :: Directive log_format describes the format of a log entry.

  • sendfile on; :: Activate the usage of sendfile().

  • tcp_nopush on; :: This directive permits or forbids the use of the socket options TCP_NOPUSH on FreeBSD or TCP_CORK on Linux. This option is only available when using sendfile.

  • keepalive_timeout 65; :: Set keep alive timeout.

  • gzip on; :: Turn on gzip

  • listen 202.54.1.2:80 default; :: Listen to given IP:port.

  • server_name _; :: Assigns the names of virtual server.

  • access_log /var/log/nginx/access.log main; :: Set path to access file.

  • index index.html; :: Set default index file.

  • root /usr/local/www/nginx; :: Set default document root.

  • include /usr/local/etc/nginx/vhosts/*; :: Process all vhosts config files.

Create theos.in – 1st vhost directories


Type the following commands:
# mkdir $D/theos.in/{http,logs,stats}

# chown -R theosftpuser:theosftpgroup $D/theos.in/


Replace, username:groupname and domain name as per your setup.


THEOS.IN NGINX VIRTUAL HOST CONFIG FILE


Open /usr/local/etc/nginx/vhosts/theos.in.conf file, enter:
# vi $NROOT/vhosts/theos.in.conf

Append configuration as follows:


server {
listen 80;
server_name theos.in www.theos.in;
 
access_log /websites/theos.in/logs/access.log main;
 
location / {
root /websites/theos.in/http;
index index.php index.html index.htm;
}
 
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/local/www/nginx-dist;
}
 
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /websites/theos.in/http$fastcgi_script_name;
include fastcgi_params;
}
 
location ~ /\.ht {
deny all;
}
}

Save and close the file.


Create cyberciti.biz – 2nd vhost directories


Type the following commands:
# mkdir $D/cyberciti.biz/{http,logs,stats}

# chown -R user:group $D/cyberciti.biz/


CYBERCITI.BIZ NGINX VIRTUAL HOST CONFIG FILE


# vi $NROOT/vhosts/cyberciti.biz.conf

Append configuration as follows:


server {
listen 80;
server_name cyberciti.biz www.cyberciti.biz;
 
access_log /websites/cyberciti.biz/logs/access.log main;
 
location / {
root /websites/cyberciti.biz/http;
index index.php index.html index.htm;
}
 
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/local/www/nginx-dist;
}
 
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /websites/cyberciti.biz/http$fastcgi_script_name;
include fastcgi_params;
}
 
location ~ /\.ht {
deny all;
}
}

Save and close the file. Restart Nginx web server, enter:
# nginx -c /usr/local/etc/nginx/nginx.conf -t

# /usr/local/etc/rc.d/nginx restart



FreeBSD: Nginx Virtual Hosting Configuration

Setting up nginx, ssl, and virtual hosts

To install nginx you have a few options depending on the flavour of operating system you are running. You can either install it via a package manager, or download the source and compile it yourself. Using the package manager will mean you will get the latest known stable version for your OS, and have to worry less about working out dependencies or conflicts. However, you may be a version or two behind the official release.


installing nginx via yum/apt-get/rpm


If you’ve got a preferred package manager on your system then it should be as easy as one of the following (choose whichever is appropriate): sudo yum install nginx sudo apt-get install nginx


Alternatively you can download the rpm and install using that:


wget ftp://ftp.univie.ac.at/systems/linux/fedora/updates/9/i386.newkey/nginx-0.6.32-1.fc9.i386.rpm

rpm -Uvh nginx-0.6.32-1.fc9.i386.rpm

installing nginx via source


If none of the above is suitable, then you’re off to compile it on your own. The following should do the trick and include the libraries/packages we need:


wget http://sysoev.ru/nginx/nginx-0.7.2.tar.gz

tar zxvf nginx-0.7.2.tar.gz

cd nginx-0.7.2

./configure –prefix=/usr/local/nginx –sbin-path=/usr/local/sbin –with-debug –with-http_ssl_module

make

sudo make install

sudo nginx

configuring an nginx virtual host


Now that it’s up and running, time to configure nginx to know about a virtual host (or two) on your system. For now, lets just serve some static content so we get a feel for the config files:


sudo nano /usr/local/nginx/conf/nginx.conf

You’ll see the default nginx config file, in recent versions it’s fairly well commented to help you understand what is going on. Scroll down and find the definition that looks like this:


server {

listen 80;

server_name _;


#charset koi8-r;


#access_log logs/host.access.log main;


location / {

root /usr/share/nginx/html;

index index.html index.htm;

}


error_page 404 /404.html;

location = /404.html {

root /usr/share/nginx/html;

}

}

I wont go into too much detail here, the important thing to note is where the root location is. Here’s is specified as /usr/share/nginx/html, which means a request to http://yoursite.com/directory/file.html is going to try and serve the file on your server from /usr/share/nginx/html/directory/file.html. To create a new virtual host lets change this definition to look more like this:


server {

listen 80;

server_name www.yoursite.com;

root /var/www/yoursite.com/html;


location / {

index index.html index.htm;

}

}

Now all requests coming in to http://www.yoursite.com will be handled by this definition, but only requests for www.yoursite.com. If you want to handle another domain within this definition you can just put an additional server name in like this:


server_name www.yoursite.com www.othersite.com;

Alternatively, if you want to have www.othersite.com serve up content from a different location you would just add another server definition:


server {

listen 80;

server_name www.yoursite.com;

root /var/www/yoursite.com/html;


location / {

index index.html index.htm;

}

}


server {

listen 80;

server_name www.othersite.com;

root /var/www/othersite.com/html;


location / {

index index.html index.htm;

}

}

configuring nginx for your rails app


The hosts are setup, now we can have one of them start serving some rails apps. Lets change the virtual host definition we had above for www.yoursite.com to look like the following:


server {

listen 80;

server_name www.yoursite.com;

root /var/www/apps/yoursite/current/public;


# Set the max size for file uploads to 50Mb

client_max_body_size 50M;


# this rewrites all the requests to the maintenance.html

# page if it exists in the doc root. This is for capistrano’s

# disable web task

if (-f $document_root/system/maintenance.html) {

rewrite ^(.*)$ /system/maintenance.html last;

break;

}


location / {

# needed to forward user’s IP address to rails

proxy_set_header X-Real-IP $remote_addr;


# needed for HTTPS

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_set_header Host $http_host;

proxy_redirect false;

proxy_max_temp_file_size 0;


# If the file exists as a static file serve it directly without

# running all the other rewrite tests on it

if (-f $request_filename) {

break;

}


# check for index.html for directory index

# if its there on the filesystem then rewite

# the url to add /index.html to the end of it

# and then break to send it to the next config rules.

if (-f $request_filename/index.html) {

rewrite (.*) $1/index.html break;

}


# this is the meat of the rails page caching config

# it adds .html to the end of the url and then checks

# the filesystem for that file. If it exists, then we

# rewite the url to have explicit .html on the end

# and then send it on its way to the next config rule.

# if there is no file on the fs then it sets all the

# necessary headers and proxies to our upstream mongrels

if (-f $request_filename.html) {

rewrite (.*) $1.html break;

}


if (!-f $request_filename) {

proxy_pass http://railsapp;

break;

}

}

}

What we have here is a series of rules that match the requested file against some regular expressions and underlying filesystem files. To tell nginx to serve any content that it finds matching the full requested path, starting in the directory defined as root we do the following:


if (-f $request_filename) {

break;

}

if (-f $request_filename/index.html) {

rewrite (.*) $1/index.html break;

}

if (-f $request_filename.html) {

rewrite (.*) $1.html break;

}

If that doesn’t work, we assume it need to be served by the rails app so we send it through using this:


if (!-f $request_filename) {

proxy_pass http://railsapp;

break;

}

But what does http://railsapp mean? No such server exists! Within nginx we need to define an upstream proxy. This will allow us to wrap all our mongrels up within a single definition, and nginx can take care of sending it through to the instances in the back end. To define the railsapp upstream mongrels we add the following outside our server definition:


upstream railsapp {

server 127.0.0.1:3000;

server 127.0.0.1:3001;

server 127.0.0.1:3002;

}

setting up your nginx ssl server


What if we want to serve out site over HTTPS for security reasons? No problem! We just add a server definition that listens on the correct port (that’s 443 for those of you playing along at home). So our definition would look like this:


server {

listen 443;

server_name www.yoursite.com;

root /var/www/apps/yoursite/current/public;


# Rest of config here…

redirecting all traffic to your ssl server


To be extra secure, we’ve decided that we want all traffic to be handled over SSL. Well we can use the ssl_requirement plugin in our rails app to completely prevent non-HTTPS access, just incase. We can also add this server definition to our nginx config to re-direct anybody who mistakenly links to the plain old HTTP address:


server {

listen 80;

server_name www.yoursite.com;

rewrite ^/(.*) https://yoursite.com/$1 permanent;

}

setting nginx error pages


Nginx will display some standard error messages should there be a problem, they’re about as attractive as the standard ones that come with rails though. If you want to jazz them up and make the whole experience less jarring for your users then update these lines:


error_page 404 500 502 503 504 /http_error.html;

location = /http_error.html {

root /var/www/errors;

}

And point it to the file you want to come up for all your errors. If you want to differentiate between various errors then configure each one individually:


error_page 500 502 503 504 /50x.html;

location = /50x.html {

root /var/www/errors;

}

error_page 404 /404.html;

location = /404.html {

root /var/www/errors;

}

directing nginx log output


If you’re running multiple virtual hosts, it will probably pay to give each a log file of it’s own rather than having a single jumbled mess to worry about. Basically any configuration you provide in the http definition you can re-define on a per-server basis within each server definition. So simply add these lines into the relevant virtual host/server definition:


server {

listen 80;

server_name www.yoursite.com;

root /var/www/apps/yoursite/current/public;


access_log /var/log/nginx/yoursite.access.log main;

error_log /var/log/nginx/yoursite.error.log debug;


# Rest of config…

}

make nginx serve cache content from a custom location


Some people may cache their rail output into a custom directory (and why wouldn’t you, it makes clearing the cache so much easier). If that’s the case, the usual nginx/rails configuration won’t work as expected. Your site will still work, you’ll just not be making the most of letting nginx serve your static content. To resolve it, add these lines in before the section that passes the request to your upstream proxy:


if (-f /cache$request_filename) {

rewrite (.*) /cache$1 break;

break;

}


if (-f /cache$request_filename.html) {

rewrite (.*) /cache$1.html break;

break;

}

Where /public/cache is where you are storing all of your cached content. Obviously, alter to fit accordingly.



Setting up nginx, ssl, and virtual hosts

Configuring Nginx, MySQL and PHP with FastCGI (spawn-fcgi) On Ubuntu

Nginx (pronounced “engine x”) is a high-performance HTTP server. The most great and important feature from Nginx is low resource consumption. So that, you can allocated your RAM Memory to other process such as MySQL or Memcached. This tutorial shows how you can install Nginx on an Ubuntu 9.10 server with PHP5 support through FastCGI (spawn-fcgi).


Spawn FastCGI (spawn-fcgi) (http://redmine.lighttpd.net/projects/spawn-fcgi) is a project originally to support Lihttpd. On lots of tutorial and how to, if we want to configuring Nginx and FastCGI, we have also install lighttpd to get spawn-fcgi package. At that time there was still no standalone package for spawn-fcgi. Fortunately since version 9.10 ( or 9.04) Ubuntu provide a standalone spawn-fcgi on they’re repository. So that, you don’t have to install Lighttpd anymore. Lets start it!


Install package that we need for Nginx and PHP:


sudo apt-get install php5-cgi nginx spawn-fcgi


Start your Nginx server:


sudo service nginx start


Open your browser and point the adders to your IP or Hostname nginx server. If you see a page said “Welcome to nginx” it mean you are succeed installing nginx.


Now open nginx configuration file. Type:


vim /etc/nginx/sites-available/default


See part some things like this (on my ubuntu this is start on line 47):


#location ~ \.php$ {


#fastcgi_pass 127.0.0.1:9000;


#fastcgi_index index.php;


#fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;


#includefastcgi_params;


#}

Uncomment and edit it so its look like this:


location ~ \.php$ {

fastcgi_pass 127.0.0.1:9000;

fastcgi_index index.php;

fastcgi_param SCRIPT_FILENAME /var/www/nginx-default$fastcgi_script_name;

include fastcgi_params;

}


now save it.


Start your FastCGI. To start a PHP FastCGI daemon listening on port 9000 on localhost and running as the user and group www-data, we run the following command:


sudo spawn-fcgi -a 127.0.0.1 -p 9000 -u www-data -g www-data -f /usr/bin/php5-cgi -P /var/run/fastcgi-php.pid


Restart your nginx

sudo service nginx restart


Now create phpinfo.php to test your server. Type:


vi /var/www/nginx-default/info.php


and fill this line:


phpinfo();

?>


Save it.


Now call that file in a browser (e.g. http://192.168.0.100/info.php).


As you see, PHP5 is working, and it’s working through FastCGI, as shown in the Server API line.


To make your nginx start every boot, type this:


sudo update-rc.d nginx defaults


To start FastCGI every boot, open rc.local file:


sudo vim /etc/rc.local


add this before exit line:


/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -u www-data -g www-data -f /usr/bin/php5-cgi -P /var/run/fastcgi-php.pid


Its time to instal MySQL.


sudo apt-get install mysql-server mysql-client php5-mysql


You will be asked to provide a password for the MySQL root user


When its done, you have to restart nginx once again.


sudo service nginx restart


call info file in a browser again. If your see word mysql in page appeared it mean you have done your works!



Configuring Nginx, MySQL and PHP with FastCGI (spawn-fcgi) On Ubuntu

Nginx as a reverse proxy for Apache

First of all let’s see the general structure of Apache web server and why it would be a good idea to use a reverse proxy:

1. Client initiates request to the Apache server.

2. His browser connects to the Apache server.

3. The Apache server creates new thread/process to handle the request.

4. If client requested dynamic content, web server spawns CGI process or executes dynamic content handling module (i.e. mod_php) and waits while request will be processed. When it receives resulted web-page, it sends it back to the client.

5. If client asked for some static file, web server sends this file to client

6. Client’s browser receives answer, closes connection to web server and displays content.


As we can see, when there are many requests coming to the web server, the server needs to create many parallel threads/processes and keep them running while client will close connection. If client has slow connection, web server process will wait too long and resource consumption will increase very fast. In the same time, if the website has lots of static content, Apache will create lots of parallel processes which will quickly eat up the memory only to serve a static file. If the money are not a problem we can continue to buy more and more RAM and more powerful processors.


However, there is a more efficient solution. We can use a small piece of software (nginx for example) in front of the Apache web server which will handle all the requests for static content and forward to Apache only the requests for dynamic content. This way Apache will open new threads only to process the dynamic requests and will close them quickly as it won’t need to wait after the client to close the connection (this is going to be nginx’s job).


But (there’s always a but) this approach will bring us the following problems:

1. Each time a vhost is added to apache, we’ll have to add it also to nginx.

2. Because nginx is a reverse proxy layer on top of Apache, Apache will think that all connections originate from the server running nginx. Every entry in the Apache access logs will appear to come from the IP of the nginx server and securing sessions by checking that a user’s IP address hasn’t changed becomes more difficult.


I believe the first problem doesn’t bring such great hassle. I’ll show you how to add vhosts to nginx and you’ll see it’s easy.

It can even be created a small bash script which can read apache’s vhosts and generate the nginx’s ones. But this is not going to be covered in this post.


As for the second problem we’ll use the Apache mod_rpaf module to populate the REMOTE_ADDR using a special HTTP header inserted by nginx.


A typical request would work as follows:

- 1.2.3.4 sends HTTP request to nginx server;

- nginx determines that it needs to proxy pass the request to a back-end Apache server (e.g. by looking at the content-type or virtual host).

- nginx adds an HTTP header “X-Forwarded-For” with the client’s real IP

- nginx forwards (proxy_pass) the request to back-end Apache server

- mod_rpaf in Apache detects that the request is coming from the nginx IP, then substitutes REMOTE_ADDR with the contents of X-Forwarded-For

- Apache handles request as normal. Applications do not need to be aware of the reverse proxy.


Ok, enough with talking, let’s see how are we going to install nginx as a reverse proxy for a back-end Apache server. Of course we are going to use a Slackware server.


First of all we have to build mod_rpaf and configure apache to use it. Go to mod_rpaf website and get the latest version available. In this tutorial i’m going to use mod_rpaf 0.6.


cd /usr/local/src

wget http://stderr.net/apache/rpaf/download/mod_rpaf-0.6.tar.gz

tar -xzvf mod_rpaf-0.6.tar.gz

cd mod_rpaf-0.6

apxs -i -c -n mod_rpaf-2.0.so mod_rpaf-2.0.c

This is going to install mod_rpaf-2.0.so on /usr/lib/httpd/modules/


Now edit /etc/httpd/httpd.conf and add the following:


LoadModule rpaf_module lib/httpd/modules/mod_rpaf-2.0.so


RPAFenable On

RPAFsethostname On

RPAFproxy_ips 127.0.0.1

RPAFheader X-Forwarded-For

Also we have to configure apache to listen only on localhost:


Listen 127.0.0.1:80

Edit /etc/httpd/extra/httpd-vhosts.conf and make sure you use the following directive:


NameVirtualHost *:80

Make sure each of your virtual hosts are defined as:




Now we have to build and configure nginx. If you want you can use the following nginx slackware package made by me:


nginx-0763-i486-1.txz

However if you’re like me and you like to build things manually:


cd /usr/local/src

wget http://sysoev.ru/nginx/nginx-0.7.63.tar.gz


mkdir /etc/nginx

mkdir /var/log/nginx

mkdir /var/run/nginx


tar -xzvf nginx-0.7.63.tar.gz

cd nginx-0.7.63

./configure –prefix=/usr \

–conf-path=/etc/nginx/nginx.conf \

–error-log-path=/var/log/nginx/error.log \

–pid-path=/var/run/nginx/nginx.pid


make

make install


groupadd nginx

useradd -g nginx -d /var/www/htdocs -s /bin/false nginx

The next step is to edit /etc/nginx/nginx.conf file. Here it is the file i’m using:


user nginx;

worker_processes 2;


error_log /var/log/nginx/error.log;

#error_log logs/error.log notice;

#error_log logs/error.log info;


pid /var/run/nginx.pid;


events {

worker_connections 1024;

}


http {

include mime.types;

default_type application/octet-stream;


log_format main ‘$remote_addr – $remote_user [$time_local] “$request” ‘

‘$status $body_bytes_sent “$http_referer” ‘

‘”$http_user_agent” “$http_x_forwarded_for”‘;


#access_log logs/access.log main;


sendfile on;

#tcp_nopush on;


#keepalive_timeout 0;

keepalive_timeout 65;


gzip on;


server {

listen 86.55.9.90:80 default;

listen 86.55.239.6:80 default;

server_name _;

access_log /var/log/nginx/default.access.log main;


location / {

proxy_pass http://127.0.0.1:80;

include /etc/nginx/proxy.conf;

}

}

include /etc/nginx/vhosts/*[^~];

}

Create /etc/nginx/proxy.conf template file which is going to be used on every vhost:


proxy_redirect off;

proxy_set_header Host $host;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

client_max_body_size 10m;

client_body_buffer_size 128k;

proxy_connect_timeout 90;

proxy_send_timeout 90;

proxy_read_timeout 90;

proxy_buffers 32 4k;

Now you have to set up your virtual hosts. Here it is how /etc/nginx/vhosts/razvan.ws vhost file looks like:


server {

listen 86.55.239.2:80;

server_name www.razvan.ws razvan.ws;

# I’m not going to use nginx to create an access log as this is created by apache anyway

#access_log /var/log/nginx/razvan.ws.access.log main;


location / {

proxy_pass http://127.0.0.1:80;

include /etc/nginx/proxy.conf;

}


location ~* ^.+\.(jpe?g|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|swf|avi|mp3)$ {

expires 1d;

root /var/www/htdocs/razvan.ws;

}

}

Let’s create a nice slackware-like /etc/rc.d/rc.nginx script to start/stop/restart nginx:


#!/bin/sh

#

# /etc/rc.d/rc.nginx

#

# Start/stop/restart the nginx web server.


nginx_start() {

/usr/sbin/nginx -c /etc/nginx/nginx.conf

}


nginx_stop() {

killall nginx

rm -f /var/run/nginx.pid

}


nginx_restart() {

nginx_stop

nginx_start

}


case “$1″ in

‘start’)

nginx_start

;;

‘stop’)

nginx_stop

;;

‘restart’)

nginx_restart

;;

*)

echo “Usage: $0 {start|stop|restart}”

;;

esac

Now the only thing left is to restart apache and start nginx:


apachectl restart

/etc/rc.d/rc.nginx start

If everything went well, we’ll have the following processes:


4263 ? Ss 0:00 nginx: master process /usr/bin/nginx -c /etc/nginx/nginx.conf

4264 ? S 0:00 \_ nginx: worker process

4265 ? S 0:00 \_ nginx: worker process

4836 ? Ss 0:00 /usr/bin/httpd -k start

4837 ? S 0:00 \_ /usr/bin/fcgi- -k start

4896 ? Ss 0:00 | \_ /usr/bin/php-cgi

4897 ? S 0:00 | \_ /usr/bin/php-cgi

4898 ? S 0:00 | \_ /usr/bin/php-cgi

4838 ? Sl 0:00 \_ /usr/bin/httpd -k start

4866 ? Sl 0:00 \_ /usr/bin/httpd -k start

Check out your apache access logs to see if everything is ok. Also if you want to make sure nginx is serving the static files, enable nginx access log as well and see if it gets the hits correctly.


Now the server is able to handle more traffic with the less resources. Everything is done transparently for the currently written scripts and for the users.



Nginx as a reverse proxy for Apache

Nginx as a Reverse Proxy

We have chosen to go with a standard Apache 2 installation using libapache2_mod_php5 over using Nginx (pronounced ‘Engine X’) with fastCGI. You may be thinking “that is preposterous, why not just use Nginx as your webserver and ditch Apache?” I hate fastCGI, I’ve never had very good luck with it and most importantly I know Apache. Also, when all Apache has to worry about is the dynamic content, in this case PHP, it is quite fast, and has a smaller memory footprint then normal Apache usage.


Using Nginx as a reverse proxy is great for a few reasons. Firstly it handles static content very well. It is able to handle the requests and serve static content much faster in our tests and this has cut our page load time in about half (using YSlow with a clear cache). The memory footprint of Nginx is very small so this extra speed increase is worth every megabyte, in this case .6 megabytes of our total ram on a 540 megabyte server. Secondly, it allows for quick and easy migration of your Apache services to another server. Through the config files you are able to specify an IP of your server and a port. If your apache server is taking a pounding it wouldn’t be difficult to move it to another server and just change the proxy IP to your now remote server.


Setting up Nginx is fairly straight forward. I will be showing the commands for an Ubuntu 8.04 installation but they should work for previous versions and other distributions (with a little tweaking).


Install Nginx


sudo apt-get install nginx

the following is essentially the config file we use for /etc/nginx/nginx.conf and is pretty similar to the default config for the installation. The only major thing I changed was adding gzip compression. I have personally set the level to 5 although it is adjustable. The higher you set this value the more CPU intensive it becomes.


user www-data;

worker_processes 2;

error_log /var/log/nginx/error.log;

pid /var/run/nginx.pid;

events {

worker_connections 1024;

}

http {

include /etc/nginx/mime.types;

default_type application/octet-stream;

access_log /var/log/nginx/access.log;

server_names_hash_bucket_size 64;

sendfile on;

tcp_nopush on;

#keepalive_timeout 0;

keepalive_timeout 65;

tcp_nodelay on;

gzip on;

gzip_comp_level 5;

gzip_http_version 1.0;

gzip_min_length 0;

gzip_types text/plain text/html text/css image/x-icon

application/x-javascript;

gzip_vary on;

include /etc/nginx/conf.d/*.conf;

include /etc/nginx/sites-enabled/*;

You are going to want to make sure that the line “include /etc/nginx/conf.d/*.conf;” is included in this config. This is where you will store the default proxy information.


We will now configure the default proxy. Create the file proxy.conf in the /etc/nginx/conf.d/ folder with the following contents.


proxy_redirect off;

proxy_set_header Host $host;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

client_max_body_size 10m;

client_body_buffer_size 128k;

client_header_buffer_size 64k;

proxy_connect_timeout 90;

proxy_send_timeout 90;

proxy_read_timeout 90;

proxy_buffer_size 16k;

proxy_buffers 32 16k;

proxy_busy_buffers_size 64k;

The only thing you may want to change is the buffer sizes. We had to increase our proxy_buffer_size and a few others, from the default, to allow for larger cookies that were choking Nginx. With that being said you may want to decrease the buffers a bit, just do some testing. If the buffers are not working for your content Nginx will throw a 50x error.


Finally, we will configure the various hosts. To save yourself some time, and possible a headache you should always keep your static assets in one folder, while subdividing them by type in containing folders. For example static->images, static->js, static->css. This will greatly simplify your Nginx installation and I’ve found your code.


Now we will edit (with your favorite CLI editor) /etc/nginx/sites-available/default.


server {

listen 80;

server_name example.com;

access_log /var/www/example.com/log/nginx.access.log;

error_log /var/www/example.com/log/nginx_error.log debug;


#set your default location

location / {

proxy_pass http://127.0.0.1:8080/;

}


#I had a problem accessing phpmyadmin with an Nginx reverse

#proxy without adding this location

location /phpmyadmin {

proxy_pass http://127.0.0.1:8080/phpmyadmin;

allow 1.1.1.1;

deny all;

}

#set your static folder location without the proxy pass so Nginx

#will server those files. We also set expires max to add an

#expires to have the client cache the files. You will

#have to #set a version on your css and js files to prevent

#the user who has cached files from not receiving new versions.

location /static {

root /var/www/example.com/htdocs/;

expires max;

}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html

#

error_page 500 502 503 504 /50x.html;

location = /50x.html {

root /var/www/nginx-default;

}

}

#If you have a subdomain you need to add a new server if you

#want Nginx to server the static files. Our subdomain only

#serves static files so we have not set up a proxy_pass

server {

listen 80;

server_name subdomain.example.com;

error_page 500 502 503 504 /50x.html;

location = /50x.html {

root /var/www/nginx-default;

}

access_log /var/www/subdomain.example.com/log/nginx.access.log;

error_log /var/www/subdomain.example.com/log/nginx.error.log;

index index.html;

location / {

expires max;

root /var/www/subdomain.example.com/htdocs/;

}

}

Finally we need to make some quick changes to Apache and we’ll finally have everything running. Edit the file /etc/apache2/ports.conf.


You’ll want to change the listen line to 127.0.0.1:8080. This will prevent apache from receiving requests from outside, but you should be blocking port 8080 anyways! The port we’ve set is 8080 but whatever you set in the Nginx configs is what you should use.


NameVirtualHost *

Listen 127.0.0.1:8080

Lastly, if you don’t want all your apache logs to show 127.0.0.1 for who is accessing your files or your application uses IP’s to track sessions you need to install libapache2-mod-rpaf. It is painless just issue the command below.


sudo apt-get install libapache2-mod-rpaf

reload or restart both Apache2 and Nginx.


/etc/init.d/apache2 restart

/etc/init.d/nginx restart

To see if it is working open a page on your website, if you don’t see any errors that is a good start. You can then check the logs of Apache and Nginx. Your Apache logs should only contain the php requests and your Nginx logs should contain all of your assets. Your Apache logs should also have HTTP 1.0 request when they go through the reverse proxy.


If you need any support just leave a comment and we’ll try and help you.



Nginx as a Reverse Proxy

High-Performance Web Server and Reverse Proxy

Apache is the most popular Web server and one of the most successful open-source projects of all time. Since April 1996, Apache has served more Web sites than any other Web server. Many of the world’s largest Web sites, including YouTube, Facebook, Wikipedia and Craigslist, use Apache to serve billions of page views per month. Over the years, Apache has proven itself to be a very stable, secure and configurable Web server. Although Apache is an excellent Web server, what if there were an alternative with the same functionality, a simpler configuration and better performance? That Web server exists, and it’s called Nginx.


Nginx, pronounced “Engine X”, is a high-performance Web server and reverse proxy. It was created by Igor Sysoev for www.rambler.ru, Russia’s second-largest Web site. Rambler has used Nginx since summer 2004, and it’s currently serving about 500 million requests per day. Like Apache, Nginx is used by some of the largest Web sites in the US, including WordPress (#26), YouPorn (#27), Hulu and MochiMedia. As of May 2008, Nginx is the fourth-most-popular Web server, and it is currently serving more than two million Web sites. As it is only trailing behind Apache, IIS and GFE, it is effectively the second-most-popular Web server available for Linux.


Why Use Nginx?

Like Apache, Nginx has all the features you would expect from a leading Web server:


Static file serving.


SSL/TLS support.


Virtual hosts.


Reverse proxying.


Load balancing.


Compression.


Access controls.


URL rewriting.


Custom logging.


Server-side includes.


WebDAV.


FLV streaming.


FastCGI.


It is stable, secure and very easy to configure, as you will see later in the article. However, the main advantages of Nginx over Apache are performance and efficiency.


I ran a simple test against Nginx v0.5.22 and Apache v2.2.8 using ab (Apache’s benchmarking tool). During the tests, I monitored the system with vmstat and top. The results indicate that Nginx outperforms Apache when serving static content. Both servers performed best with a concurrency of 100. Apache used four worker processes (threaded mode), 30% CPU and 17MB of memory to serve 6,500 requests per second. Nginx used one worker, 15% CPU and 1MB of memory to serve 11,500 requests per second.


Nginx is able to serve more requests per second with less resources because of its architecture. It consists of a master process, which delegates work to one or more worker processes. Each worker handles multiple requests in an event-driven or asynchronous manner using special functionality from the Linux kernel (epoll/select/poll). This allows Nginx to handle a large number of concurrent requests quickly with very little overhead. Apache can be configured to use either a process per request (pre-fork) or a thread for each request (worker). Although Apache’s threaded mode performs much better than its pre-fork mode, it still uses more memory and CPU than Nginx’s event-driven architecture.


Installation and Basic Usage

Nginx is available in most Linux distributions. For this article, I use Ubuntu 8.04 (Hardy), which includes Nginx version 0.5.33. If your distro does not have Nginx, or if you want to run a newer version, you always can download the latest stable version (v0.6.31 at the time of this writing) and install from source.


Run the following command as root to install Nginx:


# apt-get install nginx

Now that Nginx is installed, you can use the startup script to start, stop or restart the Web server:


# /etc/init.d/nginx start

# /etc/init.d/nginx stop

# /etc/init.d/nginx restart

Most configuration changes do not require a restart, in which case you can use the reload command. It is generally a good idea to test the Nginx configuration file for errors before reloading:


# nginx -t

# /etc/init.d/nginx reload

Let’s go ahead and start the server:


# /etc/init.d/nginx start

Nginx now should be running on your machine. If you open http://127.0.0.1/ in your browser, you should see a page with “Welcome to nginx!”.


Main Configuration File

Now that Nginx is installed, let’s take a look at its config file, located at /etc/nginx/nginx.conf. This file contains the server-wide settings for Nginx, and it should look similar to this:


user www-data;

worker_processes 1;

error_log /var/log/nginx/error.log;

pid /var/run/nginx.pid;

events {

worker_connections 1024;

}

http {

include /etc/nginx/mime.types;

default_type application/octet-stream;

access_log /var/log/nginx/access.log;

sendfile on;

keepalive_timeout 65;

tcp_nodelay on;

gzip on;

include /etc/nginx/sites-enabled/*;

}

We are not going to change any of these settings, but let’s talk about some of them to help us understand how Nginx works. The worker_processes setting tells Nginx how many child processes to start. If your server has more than one processor or is performing large amounts of disk IO, you might want to try increasing this number to see if you get better performance. The worker_connections setting limits the number of concurrent connections per worker process. To determine the maximum number of concurrent requests, you simply multiply worker_processes by worker_connections.


The error_log and access_log settings indicate the default logging locations. You also can configure these settings on a per-site basis, as you will see later in the article. Like Apache, Nginx is configured to run as the www-data user, but you easily can change this with the user setting. The startup script for Nginx needs to know the process ID for the master process, which is stored in /var/run/nginx.pid, as indicated by the pid setting.


The sendfile setting allows Nginx to use a special Linux system call to send a file over the network in a very efficient manner. The gzip option instructs Nginx to compress each response, which uses more CPU but saves bandwidth and decreases response time. Additionally, Nginx provides another compression module called gzip precompression (available as of version 0.6.24). This module looks for a compressed copy of the file with a .gz extension in the same location and serves it to gzip-enabled clients. This prevents having to compress the file each time it’s requested.


The last setting we are concerned with is the include directive for the sites-enabled directory. Inside /etc/nginx, you’ll see two other directories, /etc/nginx/sites-available and /etc/nginx/sites-enabled. For each Web site you want to host with Nginx, you should create a config file in /etc/nginx/sites-available, then create a symlink in /etc/nginx/sites-enabled that points to the config file you created. The main Nginx config file includes all the files in /etc/nginx/sites-enabled. This helps organize your configuration files and makes it very easy to enable and disable specific Web sites.



High-Performance Web Server and Reverse Proxy