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
Today engaged in a N-long virtual directory configuration, in almost to give up when the occasional see an article, will my problem fix
My requirement is this, the system has a dedicated folder for storing pictures, css,js or attachments, such as:
Http://www.test.com/resources/images/a.jpg
Http://www.test.com/resources/css/a.css
Http://www.test.com/resources/js/a.js
Http://www.test.com/resources/attach/a.doc
This configuration is quite easy for Apache,
To access this folder through location URI rule matching, I use the following configuration:
Location ^~/resources/{
Root d:/www/;
}
Tried n many times can not access, has been reported 404, incomparable Cup! Finally read the above provided blog to solve, and found that the original blogger, no Real clear, location in the root and alias of the difference, and finally modified into:
Location ^~/resources/{
Alias d:/www/;
}
I was able to achieve my needs successfully.
The original stickers are as follows:
Niginx does not seem to have a virtual directory, but it is a workaround to specify the path to which Nginx accesses the request path.
(Original link http://ddbiz.com/?p=187)
server {
Listen default;
server_name _;
Location/{
root HTML;
Index 403.html;
}
Location ~//.ht {
Deny all;
}
location/phpadmin/{
alias/opt/www/phpadmin/;
Index index.php;
}
Location ~/.php$ {
Include httpd.conf;
}
}
It is important to note that location/phpadmin/{} and Location/phpadmin {} are completely different.
The former can access the directory, while the latter will be redirected to the server, such as: Http://127.0.0.1/phpadmin, will be redirected to Http://_/phpadmin
The following configuration is basically similar to the above, except that all access to/phpadmin/is parsed correctly, while other accesses return information that does not exist on the page (404).
server {
Listen default;
server_name _;
Location/{
root HTML;
#index 403.html;
return 404;
}
Location ~//.ht {
Deny all;
}
location/phpadmin/{
alias/opt/www/phpadmin/;
Index index.php;
}
Location ~/.php$ {
Include httpd.conf;
}
}
Original Sticker Address: http://blog.sina.com.cn/s/blog_6c2e6f1f0100l92h.html
Installation and configuration of Windows Nginx (GO)