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. Startbe careful not to double-click on the Nginx.exe, which will cause the configuration to restart after modification, stop nginx Invalid, you need to manually close all the Nginx process in the Task ManagerIn the Nginx.exe directory, open command line tool, start/close/restart Nginx with command: Start nginxnginx-s Reload: Reload after modifying configuration 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
Introduction to installing and using Windows Nginx