teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

apacheの設定を追加

2019/10/24 07:08

投稿

Diwamoto
Diwamoto

スコア57

title CHANGED
File without changes
body CHANGED
@@ -24,5 +24,85 @@
24
24
 
25
25
  ### 補足情報(FW/ツールのバージョンなど)
26
26
 
27
+ apacheのsslの設定です。default-ssl.confをコピーしてキーのディレクトリとvhostを設定してます。
28
+
29
+ ```conf
30
+ <IfModule mod_ssl.c>
31
+ <VirtualHost *:443>
32
+
33
+ DocumentRoot /var/www/html
34
+
35
+ # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
36
+ # error, crit, alert, emerg.
37
+ # It is also possible to configure the loglevel for particular
38
+ # modules, e.g.
39
+ LogLevel info ssl:warn
40
+
41
+ ErrorLog ${APACHE_LOG_DIR}/error.log
42
+ CustomLog ${APACHE_LOG_DIR}/access.log combined
43
+
44
+ SSLEngine on
45
+
46
+
47
+ SSLCertificateFile /etc/apache2/ssl/keys/server.pem
48
+ SSLCertificateKeyFile /etc/apache2/ssl/keys/server-key.pem
49
+
50
+ # Server Certificate Chain:
51
+ # Point SSLCertificateChainFile at a file containing the
52
+ # concatenation of PEM encoded CA certificates which form the
53
+ # certificate chain for the server certificate. Alternatively
54
+ # the referenced file can be the same as SSLCertificateFile
55
+ # when the CA certificates are directly appended to the server
56
+ # certificate for convinience.
57
+ #SSLCertificateChainFile /etc/apache2/ssl.crt/server-ca.crt
58
+
59
+ # Certificate Authority (CA):
60
+ # Set the CA certificate verification path where to find CA
61
+ # certificates for client authentication or alternatively one
62
+ # huge file containing all of them (file must be PEM encoded)
63
+ # Note: Inside SSLCACertificatePath you need hash symlinks
64
+ # to point to the certificate files. Use the provided
65
+ # Makefile to update the hash symlinks after changes.
66
+ #SSLCACertificatePath /etc/ssl/certs/
67
+ #SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt
68
+
69
+ # Certificate Revocation Lists (CRL):
70
+ # Set the CA revocation path where to find CA CRLs for client
71
+ # authentication or alternatively one huge file containing all
72
+ # of them (file must be PEM encoded)
73
+ # Note: Inside SSLCARevocationPath you need hash symlinks
74
+ # to point to the certificate files. Use the provided
75
+ # Makefile to update the hash symlinks after changes.
76
+ #SSLCARevocationPath /etc/apache2/ssl.crl/
77
+ #SSLCARevocationFile /etc/apache2/ssl.crl/ca-bundle.crl
78
+
79
+ # Client Authentication (Type):
80
+ # Client certificate verification type and depth. Types are
81
+ # none, optional, require and optional_no_ca. Depth is a
82
+ # number which specifies how deeply to verify the certificate
83
+ # issuer chain before deciding the certificate is not valid.
84
+ #SSLVerifyClient require
85
+ #SSLVerifyDepth 10
86
+
87
+
88
+ <FilesMatch ".(cgi|shtml|phtml|php)$">
89
+ SSLOptions +StdEnvVars
90
+ </FilesMatch>
91
+ <Directory /usr/lib/cgi-bin>
92
+ SSLOptions +StdEnvVars
93
+ </Directory>
94
+
95
+
96
+ ServerName localhost
97
+ ServerAlias *.localhost
98
+ VirtualDocumentRoot "/var/www/html/%1"
99
+ <Directory "/var/www/html">
100
+ AllowOverride All
101
+ </Directory>
102
+
103
+ </VirtualHost>
104
+ </IfModule>
105
+ ```
106
+
27
107
  こちらの環境を使っています(ステマじゃないよ)
28
108
  https://github.com/Diwamoto/docker-lamp

1

2019/10/24 07:08

投稿

Diwamoto
Diwamoto

スコア57

title CHANGED
File without changes
body CHANGED
@@ -1,25 +1,28 @@
1
1
  ### 前提・実現したいこと
2
2
 
3
+ dockerでphp+apache+mysql+mailhogなローカル環境を作り動かしていて、virtualhostで複数サイトを同時に起動できるようにしています。
3
- ここに質問の内容く書いてください。
4
+ ふとローカル環境ssl化と思い、mkcertでワイルドカード証明書を作り動かしたところどうしもchromeに怒られてしまます
4
- (例)PHP(CakePHP)で●●なシテムを作っています。
5
+ apacheの設定はデフォルトの設定をコピーし、crtとkeyファイルのパスを自分で作ってコンテナにコピーした証明書で作っています。
5
- ■■な機能を実装中に以下のエラーメッセージが発生しました。
6
6
 
7
7
  ### 発生している問題・エラーメッセージ
8
8
 
9
- ```
10
- エラーッセージ
9
+ 特定のドインのみ(aaa.localhost)だとうまくいくが、*.localhostで証明書を作るとcommonnameerrorが発生する
11
- ```
12
10
 
13
11
  ### 該当のソースコード
14
12
 
15
- ```ここに言語名を入力
13
+ ```bash
16
- ソースコード
14
+ mkcert "*.localhost"
17
15
  ```
16
+ したものをserver.crtとserver.keyにリネームして使っています
18
17
 
19
18
  ### 試したこと
20
19
 
20
+ ネットで「openssl chromeに怒られない ワイルドカード」等で検索し、出てきたものを使って実行したりしてみた
21
- ここに問題に対して試したこを記載ださ
21
+ 特定ドメインだ動くので、apacheの設定はおかしくと思う
22
+ せっかくmampからdockerに乗り換え、vhostの設定をいちいち書かなくていいようにしたのに、sslのためにまた一つ一つ書くのが面倒
22
23
 
24
+
23
25
  ### 補足情報(FW/ツールのバージョンなど)
24
26
 
25
- こにより詳細な情報記載しくださ
27
+ ちらの環境使っています(ステマじゃないよ)
28
+ https://github.com/Diwamoto/docker-lamp