[ApacheServerのインストール]
注意
・Apacheをインストールする際は、Apache 2.4.37以降を使うこと。
Apache 2.4.37からOpenSSL1.1.1とTLSv1.3をサポートしているため。
手順
1.Apacheをダウンロードする。
ダウンロード先
OpenSSLを同梱したApacheをダウンロードする。
・Apache Haus
https://www.apachehaus.com/cgi-bin/download.plx
・個人(win32ビット対応のApacheServer)
https://emg-my.sharepoint.com/:u:/r/personal/s-tsuruda_eandm_co_jp/Documents/tools/ApacheServer/httpd-2.4.39-o111b-x86-vc15.zip?csf=1&e=mJgi2i
.ダウンロードした「httpd-2.4.39-o111b-x86-vc15.zip」ファイルを解凍します。
例:c:\Apache\
2.Apache設定ファイル(httpd.conf)の編集
httpd.confの格納先
例:C:\Apache\Apache24\conf
[ServerRoot]
--------------------------------------------------------------------------------
修正前
Define SRVROOT "/Apache24"
ServerRoot "${SRVROOT}"
修正後
Define SRVROOT "C:/Apache/Apache24"
ServerRoot "${SRVROOT}"
--------------------------------------------------------------------------------
[Listen]
--------------------------------------------------------------------------------
修正前
Listen 80
修正後
Listen 172.27.67.146:80
--------------------------------------------------------------------------------
[ServerName]
--------------------------------------------------------------------------------
修正前
ServerName localhost:80
修正後
ServerName 172.27.67.146:80
--------------------------------------------------------------------------------
[DocumentRoot]
--------------------------------------------------------------------------------
修正前
DocumentRoot "${SRVROOT}/htdocs"
修正後
DocumentRoot "C:/Apache/Apache24/htdocs"
--------------------------------------------------------------------------------
3.秘密鍵(server.key)の生成
Apacheインストールディレクトリのbinに移動して、以下のコマンドを実行します。
C:\Apache\Apache24\bin>openssl.exe genrsa -out ..\conf\server.key 1024
Loading 'screen' into random state - done
Generating RSA private key, 1024 bit long modulus
...............................++++++
.............................................++++++
e is 65537 (0x10001)
4.公開鍵(server.csr)の生成
2項と同じディレクトリで以下のコマンドを実行します。
C:\Apache\Apache24\bin>openssl.exe req -new -key ..\conf\server.key -out ..\conf\server.csr -config ..\conf\openssl.cnf
.csr -config ..\conf\openssl.cnf
Loading 'screen' into random state - done
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:JP
State or Province Name (full name) [Some-State]:Tokyo
Locality Name (eg, city) []:City
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Company
Organizational Unit Name (eg, section) []:Section
Common Name (e.g. server FQDN or YOUR name) []:127.0.0.1
Email Address []:foo@bar.com
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
5.証明書(server.crt)の生成
2項と同じディレクトリで以下のコマンドを実行します。
C:\Apache\Apache24\bin>openssl.exe x509 -in ..\conf\server.csr -out ..\conf\server.crt -req -signkey ..\conf\server.key -days 365
-req -signkey ..\conf\server.key -days 365
Loading 'screen' into random state - done
Signature ok
subject=/C=JP/ST=Tokyo/L=City/O=Company/OU=Section/CN=127.0.0.1/emailAddress=foo@bar.com
Getting Private key
5.Apacheインストール
2項と同じディレクトリで以下のコマンドを実行します。
C:\Apache\Apache24\bin>httpd -k install
6.Apacheの起動方法
2項と同じディレクトリで以下のコマンドを実行します。
C:\Apache\Apache24\bin>httpd -k start
何も表示されずに、入力欄が表示されたら、ブラウザを起動してください。
ブラウザのURL入力欄に、「http://localhost/」と入力し「Enter」を押してこのような画面が表示されたら、Apacheが正常に起動していることになります。
■エラー
「症状」
コンピューターに VCRUNTIME140.dll がないため、プログラムを開始できません。この問題を解決するには、プログラムを再インストールしてみてください。
「対策」
このエラーは、Visual Studio C++ 2015という開発環境で作成されたソフトウェアの実行時に発生するようです。
上環境で作成されたソフトは実行にランタイムというプログラムが必要ですがインストールされていないので、その旨のエラーが表示されています。
よって、Visual Studio C++ 2015のランタイムをインストールすれば解決します。
ランタイムのインストール方法
マイクロソフト公式ダウンロードセンターにアクセスし、ダウンロード をクリッ
https://www.microsoft.com/ja-jp/download/details.aspx?id=48145
■参考URL
http://www.koikikukan.com/archives/2013/12/03-012345.php
https://qiita.com/naganao/items/fe119b2818479b730c74
https://techacademy.jp/magazine/1846
http://proengineer.internous.co.jp/content/columnfeature/5456
https://http2.try-and-test.net/tls13_apache_conf.html
https://www.unknownengineer.net/entry/2018/11/15/145720