Qiita Conference 2025

みのるん (@minorun365)

30代からでも遅くない! 内製開発の世界に飛び込み、最前線で戦うLLMアプリ開発エンジニアになろう

0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Node jsでHello WorldをVPSにデプロイする

Posted at

nodejsのインストールは、省略

mac

brew install nodejs

ubuntu

sudo apt-get install nodejs
sudo apt-get install npm

node js で Hello Worldを書く。

hello.js
var http = require('http');

var server = http.createServer(function( request, response){
    response.writeHead(200, {'Content-Type': 'text/plain'});
    response.end("Hello World\n");
});

server.listen(8000);

console.log("Server running at http://localhost:8000/");

動かしてみる

node hello.js

ブラウザで、localhost:8000を開くと、hello worldが見えるはず!
チョー簡単。

flight plan

server

daemon化するためのforeverをインストール

npm install -g forever

local

install flightplan

npm install -g flightplan

config file

flightplan.js
// flightplan.js
var appName = 'sample-node-app';
var username = 'yourusername'
var plan = require('flightplan');

// configuration
plan.target('staging', {
  host: 'yourdomain.com',
  port: <your ssh port>,
  username: username,
  agent: process.env.SSH_AUTH_SOCK
});

plan.target('production', [
  {
    host: 'yourdomain.com',
    port: <your ssh port>,
    username: username,
    agent: process.env.SSH_AUTH_SOCK
  }
]);

deploy

fly production
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up

Qiita Conference 2025 will be held!: 4/23(wed) - 4/25(Fri)

Qiita Conference is the largest tech conference in Qiita!

Keynote Speaker

ymrl、Masanobu Naruse, Takeshi Kano, Junichi Ito, uhyo, Hiroshi Tokumaru, MinoDriven, Minorun, Hiroyuki Sakuraba, tenntenn, drken, konifar

View event details
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?