First, to the official website to download the nginx1.0.11 version of Windows, official website download: http://nginx.org/download/nginx-1.0.11.zip
After downloading to the package, unzip the Nginx-nginx1.0.11.zip package to your favorite root directory and change the directory name to Nginx.
Then, perform the following actions:
CD Nginx
Start Nginx
In this way, the Nginx service is started. Open Task Manager to view the Nginx.exe process, with two processes showing up, consuming system resources, which is fairly small. Then open the browser, enter HTTP://127.0.0.1/can see Nginx welcome page, Very friendly
Nginx-s Stop//Stop Nginx
Nginx-s Reload//Reload configuration file
Nginx-s quit//exit Nginx
Second, the next step is to configure Nginx conf file. Here is my configuration:
#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;
Include: /conf.d/*.conf;
#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$ {
# Proxy_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
#
#location ~/\.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;
# }
#}
}
server { listen; server_name localhost; Root E:/workspaces/react-project/build; Location/api { proxy_pass http://127.0.0.1; }}
Installation and configuration of Windows Nginx