Nginx Windows under construction process

Source: Internet
Author: User

Table of Contents:

    • Brief introduction
    • Download installation
    • Configuration test

First, a brief introduction

Nginx ("Engine X") is a high-performance HTTP and reverse proxy server, also a IMAP/POP3/SMTP proxy server. Nginx was developed by Igor Sysoev for the second rambler.ru site of Russian traffic, and the first public version 0.1.0 was released on October 4, 2004. It publishes the source code in the form of a BSD license, which is known for its stability, rich feature set, sample configuration files, and consumption of low system resources. June 1, 2011, Nginx 1.0.4 released.

Nginx as a Load Balancer server: Nginx can either directly support the internal Rails and PHP programs outside the service, also can support as an HTTP proxy server external services. Nginx is written in C, which is much better than Perlbal, both in terms of system resource overhead and CPU efficiency.

As a mail proxy: Nginx is also a very good mail proxy server (one of the first to develop this product is also as a mail proxy server), last. FM describes the success and the wonderful use of experience.

Nginx is a very simple installation, the configuration file is very concise (also can support Perl syntax), Bugs very few servers: Nginx boot is particularly easy, and can be almost uninterrupted operation, even if the run for several months do not need to restart. You will also be able to upgrade the software version without interruption of service.

(More introduction to the encyclopedia, more use of Google, advertised)

Second, download the installation

We use Nginx 1.0.4 for Windows version, download unzip and put to C:\nginx-1.0.4 (official website so requested, do not know to put other disks have no problem)

Run Cmd.exe to

There is a mistake ah, do not know whether the success of the start, go to check the log bar.

There are two log files in the logs Access.log,error.log, open Error.log to the following prompt

2011/06/16 15:23:55 [Emerg] 7136#4040:bind () to 0.0.0.0:80 failed (10013:an attempt is made to access a socket in a- Forbidden by its access permissions)
2011/06/16 15:24:14 [Emerg] 6336#7052:bind () to 0.0.0.0:80 failed (10013:an attempt is made to access a socket in a- Forbidden by its access permissions)

To the Nginx website search for a reason:

View Code

3 reasons:

1. The firewall is turned on (it is true that my WIN7 Windows Firewall is open, but I can't start the nginx after I shut it down)

2.80 Port is occupied (there is a default site with 80 port, shut down and then start Nginx Normal, gen Y for nginx default configuration)

How to look out of the normal, look at the logs below is not more than a nginx.pid file, cmd window entered

C:\nginx-1.0.4>tasklist/fi "imagename eq nginx.exe"
The results are as follows:

At this point the explanation has been successful, there are two processes. According to the official explanation, Nginx is the daemon, one of which is always handling event waits, and when an event is triggered, start another process to process the request.

After the successful access can be logs under the Access.log to see the request information to visit the site

View Code

If you are not successful, you can review the Error.log cause under logs, and the following are the other operations commands

Nginx-s stop Quick exit
Nginx-s quit Graceful quit
Nginx-s Reload Changing configuration, starting a new worker, quitting an old worker gracefully
Nginx-s Reopen Reopening log files

The official website provides detailed Windows usage installation instructions, and most of the online writing is messy. For the first time, the other people on the internet did not succeed.-_-| | |, found that the official website has installation instructions to follow the operation of the success, so we recommend that you later crossing network instructions and source code, you can take a lot of detours.

Third, the configuration test

In the second session we used the default nginx.conf. Nginx configuration files are stored in the directory conf file, where nginx.conf is its main configuration file.

The following is a new virtual server that I annotated and configured

View Code

#号为注释内容, we're running nginx under CMD.

Startup success, error, you can query the log (log path is the configuration file specified, you can change to save to another location)

Visit the localhost:8666 address of the second server configuration, as a result:

Nginx official Website conf configuration does not provide too many documents, learning more configuration, such as caching, load balancing and so on, you can refer to the Nginx Chinese network.

Nginx Windows under construction process

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.