[Linux] Nginx + node. js + PM2 + MongoDb + (Memcached) part I

Source: Internet
Author: User
Tags memcached install node

Operating Environment :

Ubuntu 14.04 LTS running under local VirtualBox

0. Take a look at the IP address of the server

Ifconfig

My server IP is 192.168.0.108

1. Installing Nginx

First update APT package management, then install Nginx

sudo apt-get updatesudo apt-get install Nginx

Then restart the local Nginx service.

Service Nginx Restart

Then type 192.168.0.108 in the browser

You should see the following Nginx Welcome page

2. Install node. js

Use apt to install node. JS directly in versions of Ubuntu 14.04

sudo apt-get install Nodejs

Check the version of Nodejs.

Nodejs-v

3. Create a simple node. js App

Create an app's folder "HelloApp" under/var/www, and then create a file named App.js

mkdir/var//var/www//var/www/HELLOAPPVI app.js

Here is the simple code, which is the demo on http://www.nodejs.org.

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/');

And then execute it with Nodejs.

Nodejs App.js

If you use putty, you can open a new terminal with Crul to see if it is normal to perform

Related Article

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.