WindowsのWebサーバーであるIIS (Internet Information Service)を手動で設定する手順です。
Powershellを使って自動構築する手順はこちらをご覧下さい。
マイクロサービスモデル向けの設定になります。
山括弧<…>で囲まれている箇所は、ご自身の環境に合わせて書き換える必要があります。
IISの各種インストール・有効化
以下のように、コントールパネルからIISをインストール・有効化します。
ここではWindows 10 Homeの画面を示しています。(他エディションでもやる事は同様です)

URL Rewrite
URL Rewrite機能はIISのプラグインです。事前にこちらから「rewrite*.msi」をダウンロード・インストールして下さい。
ここまで実行したら、念のためOSを再起動します。
Webサイト・CGIの構築
前提
・ドキュメントルート「C:\hoge\contents」
・CGIルート「C:\hoge\cgi-bin」
にします。ドキュメントルート、CGIルートについてはこちらをご覧下さい。
また、ここでは、CGIモジュールはPHPを使い、「C:\hoge\cgi\php」に配置するものとします。
(同フォルダ以下にphp-cgi.exeなどが存在する)
1. アプリケーションプールの追加
インターネット インフォメーション サービス (IIS) マネージャーを起動して下さい。
アプリケーションプールを追加します。アプリケーションプールとは、作成するWebアプリケーションの実行環境です。

2. Webサイトの追加
Webサイトを追加します。

3. CGIの追加
CGIを追加します。



CGIモジュールを指定します。(PHP;php-cgi.exeでCGIルートのphpファイルを実行するようにする、という意味)



4. URL Rewrite(任意)
ここでは、WebサイトからサーバーサイドのCGIに対して、「http://<ip>:<port>/api/functions」というHTTPリクエストを送るものとします。(”api”は固定、”functions”は可変)
“api”を検知したら、CGIルートのindex.phpファイルが実行されるようにします。



コメント