Home  >  Article  >  Backend Development  >  nginx configuration under windows

nginx configuration under windows

WBOY
WBOYOriginal
2016-07-29 09:03:231067browse

Nginx ("engine x") is a high-performance HTTP and reverse proxy server, as well as an IMAP/POP3/SMTP server. Nginx was developed by Igor Sysoev for the Rambler.ru site, the second most visited site in Russia. The first public version 0.1.0 was released on October 4, 2004. It releases its source code under a BSD-like license and is known for its stability, rich feature set, sample configuration files, and low system resource consumption. On June 1, 2011, nginx 1.0.4 was released.

Nginx is a lightweight web server/reverse proxy server and email (IMAP/POP3) proxy server, and is released under a BSD-like protocol. It was developed by Russian programmer Igor Sysoev and is used by Rambler (Russian: Рамблер), a large Russian portal website and search engine. Its characteristics are that it occupies less memory and has strong concurrency capabilities. In fact, nginx’s concurrency capabilities do perform better among web servers of the same type. Users of nginx websites in mainland China include: Baidu, Sina, NetEase, Tencent, etc.


The project agent is going to use nginx and learn it in advance. Currently, the only servers with domain names are windows, so be familiar with Windows.

1. Download

Currently, the stable version of nginx is 1.8.1. Download it from the official website first, download address

http://nginx.org/en/download.html

This is a zip file, unzip it Then you can use it

nginx configuration under windows

2. Start the

green file, no installation is required, you can start it directly. The three startup methods are actually similar:

  • Double-click the nginx.exe icon, you can see the black window flashes by, and the startup is completed.
  • Go to the nginx directory from the command line and enter nginx to start. (Note, there is no prompt in this method and the command line window is locked)
  • Go to the nginx directory from the command line and enter start nginx to start. This method is not locked.

After starting, by default (no configuration changes), you can see There are two nginx processes, one is the master process and the other is worker processes.

Other commands

nginx -s stop quick shutdown
nginx -s quit normal shutdown
nginx -s reload change configuration, gracefully shut down old worker processes and start new ones
nginx -s reopen Reopen the log file

3. Test

By default nginx deploys some static content, we can use it to test whether nginx is working.

Default configuration file (NGINX_HOME/conf/nginx.conf):

By observing the non-comment items in the configuration file, you can know:

1. 1 worker processes are started

2. worker_connections, the maximum number of concurrent connections is 1024

3. include mime.types, introduce the file extension and file type mapping declared by the mime.types file

4. application/octet-stream, use application/octet-stream by default

5. sendfile, enable high efficiency File transfer mode

6. Listen to port 80 of the local host "localhost"

7. The mapping directory is "html directory of the current directory"

8. If 500, 502, 503, 504 errors occur, map to 50x.html

Browse the address http://localhost to access its default page, which is mapped to NGINX_HOME/html/index.html

Other static content, such as html and images, can be added for testing by yourself.

4. Log

The log is located in NGINX_HOME/logs/ by default, visible:

1, access.log, access log

2, error.log, exception log

3, nginx.pid, process (only at startup This log only appears after nginx)

The above introduces the nginx configuration under windows, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn