Install and configure nginx in Windows

Source: Internet
Author: User
Tags format definition

: Http://nginx.org/download/nginx-1.2.4.zip

Decompress the package to your hard disk. My files are D: \ nginx.

Start nginx

Cd d:

CD nginx-1.2.4

Start nginx

View the nginx process in the task manager.

Enter http: // 127.0.0.1 in the browser. The welcome page of nginx appears, indicating that nginx is successfully started.

Welcome to nginx!

If you see this page, the nginx web server is successfully installed and working. Further configuration is required.

For online documentation and support please refer to nginx.org.
Specified cial Support is available at nginx.com.

Thank you for using nginx.

Other operations:

Nginx-S Stop // stop nginx

Nginx-s reload // reload the configuration file

Nginx-s quit // exit nginx

Configuration file:

# User nobody; worker_processes 1; # Number of started threads: Number of cores per book * 2
# Error location and level # error_log logs/error. log; # error_log logs/error. log notice; # error_log logs/error. log Info; # PID logs/nginx. PID; # PID process File Location events {worker_connections 1024; # maximum number of connections for each process} HTTP {include mime. types; default_type application/octet-stream; # nginx log format definition, you can reference # log_format main '$ remote_addr-$ remote_user [$ time_local] "$ request"' # '$ Status $ body_bytes_sent "$ http_referer"' # '"$ http_user_age NT "" $ http_x_forwarded_for "'; # access_log logs/access. log main; # Log Path sendfile on; # tcp_nopush on; # keepalive_timeout 0; keepalive_timeout 65; # request time # gzip on; Enable gzip compression # server as the virtual machine set, you can set multiple server {Listen 80; # The listening port SERVER_NAME localhost; # The listening domain name # 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 500 502 503 x.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. 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; # SERVER_NAME localhost; # SSL on; # ssl_certificate cert. PEM; # ssl_certificate_key cert. key ;# Ssl_session_timeout 5 m; # ssl_protocols SSLv2 SSLv3 tlsv1; # ssl_ciphers high :! Anull :! MD5; # ssl_prefer_server_ciphers on; # location/{# Root HTML; # index index.html index.htm ;#}#}}



In Linux:

Start nginx:

/Installation directory/nginx-C configuration file directory.-C is used to load the configuration file. The default value is CONF/nginx. conf under the installation directory.

Release or stop nginx:

Force stop: Kill-9 nginx

Stop with ease: Kill-Quit 'cat nginx PID directory'

Stop: Kill-term 'cat nginx PID directory 'or kill-int' cat
Nginx PID directory'

Smooth restart: Kill-Hua

'Cat nginx PID directory '(for smooth restart, check whether the configuration file is correct:/installation directory/nginx-t-c)



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.