Recently I have studied node. JS, And I am familiar with nginx configuration and usage.
1. download the latest nginx version from the official website.
Official Website: http://nginx.org I downloaded nginx/Windows-1.3.6 this version.
2. decompress the package to the local device.
Double-click nginx.exe. The black screen flashed and the nginx.exe process was started.
3. Enter http: // localhost/in the browser/
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.Commercial support is available at nginx.com.Thank you for using nginx.
Nginx has been configured.
After configuring the environment variables, you can use the following command to start and disable the nginx service.
1) Start nginx startup command
2) nginx
-S stop: stop nginx quickly without saving related information.
3) nginx
-S quit completely and orderly stop nginx and save relevant information.
4. Modify the nginx. conf file
Nginx-1.3.6 \ conf \ nginx. conf
Add under server {
Location/node {
Proxy_pass http: // 127.0.0.1: 8000;
}
5. The test. js file is as follows:
var http = require('http'); http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/plain'}); res.end('Hello World\n'); }).listen(1337, "127.0.0.1"); console.log('Server running at http://127.0.0.1:1337/');
6. Start Node. js
Command Line: Node
Test. js
Hello World