[Configuration tutorial] install Node. js on Nginx

Source: Internet
Author: User

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

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.