1. Simple Installation
1) Download
Http://nginx.org/en/download.html
2) The path after decompression
E:\Study\nginx\nginx-1.7.6
3) Execute Nginx.exe, visit http://localhost, appear welcome to nginx! Welcome content, installation successful.
4) in the installation path of the logs directory, will automatically generate a nginx.pid file, the file content is nginx main process PID.
2. Simple use of commands
Nginx-s Stop -s quit -s reload s reopen re-open log file
3. Static Content Server
When accessing the HTML file, let Nginx map to the/data/html path; When accessing the picture file, let Nginx map to the/data/image path.
1) Create the data directory, and then insert the HTML directory and the image directory separately in the data directory.
2) put index.html, hello.html files in HTML directory
3) in the image directory, put 1.jpg, 2.jpg two pictures
4) Configuration nginx.conf
Configured in the server node within the HTTP node.
Location/ { # Specifies root e:/Study/nginx/nginx-1.7. 6/data/html; # Specify first page Index index. html; } /image/ { # Specify root directory root e:/Study/nginx/nginx-1.7 . 6/data;}
5) When request Http://localhost/image/1.jpg, Nginx automatically responds http://localhost/data/image/1.jpg
When request http://localhost/hello.html, Nginx automatically responds http://localhost/data/html/hello.html
Nginx as a static content server (Windows environment)