Objective
Today, the leader of the early morning impulse to tell me, I hope that our group of computers to do Web site server cluster, you make a mess, use Ngnix bar.
June to death, the minister had to die. By the way write an article to make a note.
Brief introduction
Nginx is a high-performance HTTP and reverse proxy server, also a IMAP/POP3/SMTP service. Easy to use, low learning cost, high maintainability. portals.
Welcome to use
After downloading the nginx/windows-1.6.3 version, unzip it. There are two ways of booting
1. Double-click Nginx.exe (nonsense)
2. Execute with cmd (CD F:\nginx-1.6.3 Enter start Nginx Enter)
If successful, in the browser hit http://localhost/, will appear the Welcome page, see
Build a test Site
I built a Web site with a basic MVC framework, deployed it on IIS, and wrote two sentences in the background of index
viewdata["IP"] = system.web.httpcontext.current.request.userhostaddress;//Get IP address
viewdata["url"] = Request.Url.ToString ();//Get URL
Two variables are displayed on the page, mainly to facilitate the verification of the results.
Modifying the Ngnix configuration
Basic are ready, now modify the Ngnix configuration, map to the corresponding site address on it, nginx-1.6.3\conf under the nginx.conf file.
Altogether three modification points:
1. Add the site address you want to map on server {above
Upstream chengong.com {
Server 127.0.0.1:5555;
Server 127.0.0.1:4444;
}
2, in server_name changed to server_name chengong.com;
3. Change location to
Location/{
Proxy_pass http://chengong.com;
Proxy_redirect default;
}
Save, with cmd command ngnix.exe-s reload, multiple refresh http://localhost/.
You will see two alternate addresses displayed alternately. That means it's a success.
Additional directives
Ngnix.exe-s Stop Stop
Start Ngnix.exe Startup
Ngnix.exe-s Reload Restart
End
The overall use is still relatively simple, if you need to ngnix more advanced use can view his configuration document.
This time the main record of their own research process and results, if there are deficiencies and suggestions to trouble everyone in the comments pointed out.
Windows-based Ngnix base usage