Skip to content

Instantly share code, notes, and snippets.

@masakielastic
Last active June 16, 2025 00:07
Show Gist options
  • Select an option

  • Save masakielastic/20bd90c4c257b39fc2e426b8cfec32e7 to your computer and use it in GitHub Desktop.

Select an option

Save masakielastic/20bd90c4c257b39fc2e426b8cfec32e7 to your computer and use it in GitHub Desktop.
node-fastcgi で FCGI サーバー

node-fastcgi で FCGI サーバー

パッケージをインストールします。

npm install node-fastcgi

FastCGI サーバーを起動させます。

node server.js

cgi-fcgi を実行します。

export REQUEST_METHOD=GET
cgi-fcgi -bind -connect 127.0.0.1:8000

次のような結果が返ってくれば正常に動いています。

Status: 200 OK
Content-Type: text/plain
Date: Sun, 15 Jun 2025 23:58:03 GMT
Connection: close

It's working
var fcgi = require('node-fastcgi');
fcgi.createServer(function(req, res) {
if (req.method === 'GET') {
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end("It's working\n");
} else {
res.writeHead(501);
res.end();
}
}).listen(8000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment