The company has just used Nginx, pre-learning. Since the machine does not have a Linux environment, it is familiar under Windows.
Download
1):
http://nginx.org
At present (2017-05-30), Nginx stable version is, in the official website to download first, 12.0
2017-04-25 |
NGINX-1.13.0 Mainline version has been released. |
2017-04-12 |
nginx-1.12.0 stable version has been released, incorporating new features and bugs fixes from the 1.11.x mainline branch- Including variables support and other improvements in the stream module, HTTP/2 fixes, support for multiple SSL certificat Es of different types, improved dynamic modules support, and more. |
This is a zip file that can be used after decompression (I put it in d:\)
Start
Green files, without installation, can be started directly.
As far as I know, 3 ways of starting up are actually similar:
One, double-click the Nginx.exe icon, the Black window can be seen a flash, the start is complete.
Second, the command line to the Nginx directory, input Nginx startup. (Note that this way the command-line window has no hint and is locked)
Three, the command line to the Nginx directory, enter the start Nginx boot, this mode does not lock
After startup, by default (no modification configuration), you can see two nginx processes, one is the master process,1 is the worker processes.
If you configure 2 worker_processes in the configuration, you can see in the process that 1 is the master process,2 is a worker processes.
Test
The default Nginx deploys some static content, which we can test to see if Nginx is working.
The default configuration file (nginx_home/conf/nginx.conf) is as follows:
#user nobody;worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/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 80; server_name localhost; #charset Koi8-r; #access_log Logs/host.access.log Main; Location/{root HTML; Index index.html index.htm; } #error_page 404/404.html; # REDIRECT Server error pages to the static page/50x.html # ERRor_page 502 503 504/50x.html; Location =/50x.html {root html; } # Proxy The PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ {# ProX Y_pass http://127.0.0.1; #} # Pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # #location ~ \.php$ { # root HTML; # Fastcgi_pass 127.0.0.1:9000; # Fastcgi_index index.php; # Fastcgi_param Script_filename/scripts$fastcgi_script_name; # include Fastcgi_params; #} # Deny access to. htaccess files, if Apache ' s document Root # concurs with Nginx ' s one # #l ocation ~/\.ht {# deny all; #}} # Another virtual host using mix of ip-, name-, and port-based configuration # #server {# listen 8000; # Listen somename:8080; # server_name Somename alias Another.alias; # location/{# root HTML; # index index.html index.htm; #} #} # HTTPS Server # #server {# listen 443 SSL; # server_name localhost; # ssl_certificate Cert.pem; # Ssl_certificate_key Cert.key; # Ssl_session_cache shared:ssl:1m; # ssl_session_timeout 5m; # ssl_ciphers high:!anull:! MD5; # ssl_prefer_server_ciphers on; # location/{# root HTML; # index index.html index.htm; # } #}}
By observing the non-annotated items of the configuration file (refer to the Nginx configuration file nginx.conf Chinese), you probably know:
1. Started 1 worker processes
2, worker_connections, maximum concurrent number is 1024
3. Include mime.types, introducing the file extension and file type mappings declared by the Mime.types file
4, Application/octet-stream, default use Application/octet-stream
5, Sendfile, open efficient file transfer mode
6, listen to the local "localhost" 80 port
7. Map directory as "HTML directory for current directory"
8.500, 502, 503, 504 errors are mapped 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, images, can be added to your own test.
Log
The log is located by default in nginx_home/logs/, which is visible:
1, Access.log, access log
2, Error.log, abnormal log
3, Nginx.pid, process (only after the start of Nginx only after the log)
Reprint: http://www.cnblogs.com/nick-huang/p/4638398.html
Initial introduction of Nginx-windows under Nginx