BCLinux开源软件镜像手册-NodeJS运行环境


  • BCLinux Developers

    BCLinux开源软件镜像手册-NodeJS运行环境

    产品描述

    本镜像提供的Node.JS一个Javascript运行环境,是基于Chrome JavaScript运行时建立的平台, 用于方便地搭建响应速度快、易于扩展的网络应用。实际上是对Google V8引擎进行了封装,V8引擎执行JS的速度非常快、性能非常好。Node.js对一些特殊用例进行了优化,提供了替代的API,使得V8在非浏览器环境下运行得更好。Node.js 使用事件驱动, 非阻塞I/O 模型而得以轻量和高效,非常适合在分布式设备上运行数据密集型的实时应用。 node.js+mongodb是当前非常热门及主流的技术,在简单灵活及高性能比php+mysql组合具有明显的优势。nginx作为轻量级http服务器,能够针对http请求进行rewrite规制、反向代理、缓存设置等等很多灵活的功能,nginx+node的组合,能够让web服务更加稳定、灵活、及高效。

    环境说明

    • 操作系统:BigCloud Enterprise Linux 7
    • 软件列表:
      • nodejs-6.9.1
      • nginx-1.10.2
      • mongodb-2.6.12
      • vsftpd-3.0.2

    软件配置

    • Nginx配置文件路径:/etc/nginx/
    • Nginx网站主目录:/usr/share/nginx/html/
    • Nginx主配置文件:/etc/nginx/nginx.conf
    • Mongodb主配置文件:/etc/nginx/mongo{d|s}.conf
    • vsFTPD主配置文件:/etc/vsftpd/vsftpd.conf

    使用说明

    • 查看NodeJS版本号,确认已正确安装:
    [root@demo-bclinux-7 ~]# node -v
    v6.9.1
    
    • 查看Mongodb服务状态:
    [root@demo-bclinux-7 ~]# systemctl status mongod
    ● mongod.service - High-performance, schema-free document-oriented database
       Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled)
       Active: active (running) since Thu 2016-12-15 17:43:57 CST; 27min ago
      Process: 779 ExecStart=/usr/bin/mongod $OPTIONS run (code=exited, status=0/SUCCESS)
     Main PID: 1960 (mongod)
       CGroup: /system.slice/mongod.service
               └─1960 /usr/bin/mongod --quiet -f /etc/mongod.conf run
    
    Dec 15 17:43:32 demo-bclinux-7.2-x86-64-nodejs.novalocal systemd[1]: Starting High-performance, schema-free document-oriented database...
    Dec 15 17:43:37 demo-bclinux-7.2-x86-64-nodejs.novalocal mongod[779]: about to fork child process, waiting until server is ready for connections.
    Dec 15 17:43:37 demo-bclinux-7.2-x86-64-nodejs.novalocal mongod[779]: forked process: 1960
    Dec 15 17:43:57 demo-bclinux-7.2-x86-64-nodejs.novalocal systemd[1]: Started High-performance, schema-free document-oriented database.
    Hint: Some lines were ellipsized, use -l to show in full.
    
    • 默认FTP账号密码:nginx/bclinux,默认根目录:/usr/share/nginx/html/
    [root@demo-bclinux-7 ~]# ftp 192.168.10.41
    Connected to 192.168.10.41 (192.168.10.41).
    220 (vsFTPd 3.0.2)
    Name (192.168.10.41:root): nginx
    331 Please specify the password.
    Password:
    230 Login successful.
    Remote system type is UNIX.
    Using binary mode to transfer files.
    ftp> ls
    227 Entering Passive Mode (192,168,10,41,177,174).
    150 Here comes the directory listing.
    -rw-r--r--    1 995      992          3650 Oct 31 12:37 404.html
    -rw-r--r--    1 995      992          3693 Oct 31 12:37 50x.html
    -rw-r--r--    1 995      992          3700 Oct 31 12:37 index.html
    -rw-r--r--    1 995      992           368 Oct 31 12:37 nginx-logo.png
    -rw-r--r--    1 995      992          2811 Oct 31 12:37 poweredby.png
    226 Directory send OK.
    ftp>
    
    • 创建FTP虚拟账号fuser1,密码bclinux
    [root@demo-bclinux-7 ~]# mkdir -p /data/www
    [root@demo-bclinux-7 ~]# chown nginx:nginx /data/www
    [root@demo-bclinux-7 ~]# vim /etc/vsftpd/ftpuser.txt
    nginx
    bclinux
    fuser1 => 账号fuser1,密码bclinux
    bclinux
    [root@demo-bclinux-7 ~]# db_load -T -t hash -f /etc/vsftpd/ftpuser.txt /etc/vsftpd/vsftpd_login.db
    [root@demo-bclinux-7 ~]# cat > /etc/vsftpd/vsftpd_user_conf/fuser1 <<EOF
    > anon_world_readable_only=NO
    > write_enable=YES
    > anon_upload_enable=YES
    > anon_mkdir_write_enable=YES
    > anon_other_write_enable=YES
    > local_root=/data/www/
    > EOF
    [root@demo-bclinux-7 ~]# systemctl restart vsftpd
    [root@demo-bclinux-7 ~]# ftp localhost
    Trying ::1...
    Connected to localhost (::1).
    220 (vsFTPd 3.0.2)
    Name (localhost:root): fuser1
    331 Please specify the password.
    Password:
    230 Login successful.
    Remote system type is UNIX.
    Using binary mode to transfer files.
    ftp> ls
    229 Entering Extended Passive Mode (|||24943|).
    150 Here comes the directory listing.
    226 Directory send OK.
    ftp> quit
    221 Goodbye.
    

    服务管理

    • Nginx Server:
    systemctl { enable | start | status | restart | reload } nginx
    
    • Mongodb:
    systemctl { enable | start | status | restart } mongod
    
    • vsFTPD:
    systemctl { enable | start | status | restart } vsftpd
    

登录后回复
 

与 BC-LINUX 的连接断开,我们正在尝试重连,请耐心等待