搭建自己的网站

首先去阿里云上申请了一个域名,.site的一般比较便宜。一年只要3块钱。

yanyuqian.site

然后将域名解析到自己的云服务器上,服务端用node编写:

var http = require('http');
http.createServer(function(request,response){
    response.writeHead(200,{'Content-Type': 'text/plain'});
    response.end('This is liuyan\'s site!\n');
}).listen(80);

console.log('Server running at http://yanyuqian.site');

然后需要以root权限运行服务器,因为端口为80;

你可能感兴趣的:(搭建自己的网站)