Introduction to installing and using Windows Nginx

Source: Internet
Author: User

One of the Nginx functions can start a local server and access the target file by configuring the server_name and root directories. Download http://nginx.org/Download and unzip

Two. Modify the configuration file

Nginx config file in nginx-1.8.0\conf\nginx.conf

HTTP {     gzip on  ;    #静态文件    Server {        listen       ;        server_name  static.cnblog.com;        Location/{            root   g:/source/static_cnblog_com;        }    }    #html文件    Server {        listen       ;        server_name  127.0.0.1 localhost;        Location/{            root   g:/source/html/mobile/dist;            Index  index.html index.htm;}}}    

If you can configure multiple servers so that access to localhost is accessed to the g:/source/html/mobile/dist directory, you can also turn on gzip, compress HTML

Three. Start note do not directly double-click Nginx.exe, this will cause changes in configuration after restarting, stop nginx invalid, you need to manually close all Nginx processes in the task Manager in the Nginx.exe directory, open command-line tools, with the command to start/close/restart Nginx start Nginx: Start nginxnginx-s Reload: Modify configuration after reload takes effect nginx-s reopen: Reopen log file
NGINX-T-c/path/to/nginx.conf Test nginx configuration file is correct

Close Nginx:
Nginx-s stop: Fast Stop Nginx
Nginx-s quit: Complete and orderly stop nginx


If you encounter an error:

Bash:nginx:command not found

It's possible that you ran Windows commands in the Linux command-line environment,

If you have previously allowed nginx-s reload error, try./nginx-s Reload

or run it with a command-line tool from the Windows system

Introduction to installing and using Windows Nginx

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.