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

質問編集履歴

3

わかりにくい文面を変更

2021/11/26 03:41

投稿

space_sss
space_sss

スコア81

title CHANGED
File without changes
body CHANGED
@@ -130,7 +130,7 @@
130
130
  結果
131
131
  It works!
132
132
  とでる。
133
- これはおそらくdockerを切っても接続できるので、macの環境?
133
+ これはおそらくdockerのアプリケーション落としても接続できるので、macの環境?
134
134
 
135
135
  困っていること
136
136
  ServerNameを好きなドメイン名に変更した後になにか設定があるのか?

2

hostsの設定を追加しました。

2021/11/26 03:41

投稿

space_sss
space_sss

スコア81

title CHANGED
File without changes
body CHANGED
@@ -113,6 +113,11 @@
113
113
  ```
114
114
  test
115
115
  ```
116
+ **hosts**
117
+ ```
118
+ 127.0.0.1 local.test.com
119
+ ```
120
+
116
121
  の構成となっております。
117
122
 
118
123
  ### やってみたこと1
@@ -123,10 +128,12 @@
123
128
  ### やってみたこと2
124
129
  local.test.comにアクセス。
125
130
  結果
126
- アクセスできない
131
+ It works!
132
+ とでる。
133
+ これはおそらくdockerを切っても接続できるので、macの環境?
127
134
 
128
135
  困っていること
129
136
  ServerNameを好きなドメイン名に変更した後になにか設定があるのか?
130
- hostsファイルの設定が必要?
131
137
 
138
+
132
139
  よろしくお願いいたします。

1

質問が二つになっていたので1つの質問に絞りました。

2021/11/22 12:41

投稿

space_sss
space_sss

スコア81

title CHANGED
@@ -1,1 +1,1 @@
1
- DockerのDocumentRootとServerNameの設定
1
+ DockerのServerNameを変更し好きなドメイン名に変更しブラウザよりアクセスができるようにするには
body CHANGED
@@ -1,7 +1,8 @@
1
- DockerのDocumentRootとServerNameの設定についての質問です。
1
+ DockerのServerNameの設定についての質問です。
2
2
 
3
+ OS
4
+ mac(インテル)
3
5
  ### やりたいこと
4
- DocumentRootを/home/test/htmlに変更し
5
6
  ServerNameを好きなドメイン名に変更しブラウザよりアクセスができるようにする
6
7
 
7
8
  ###ファイル構成
@@ -20,8 +21,6 @@
20
21
  ```yml
21
22
  version: '3'
22
23
  services:
23
- version: '3'
24
- services:
25
24
  php:
26
25
  build:
27
26
  context: ./php
@@ -73,6 +72,11 @@
73
72
  ```
74
73
  **000-default.conf**
75
74
  ```
75
+ <Directory /home/test/html/>
76
+ Options Indexes FollowSymLinks
77
+ AllowOverride None
78
+ Require all granted
79
+ </Directory>
76
80
  <VirtualHost *:80>
77
81
  # The ServerName directive sets the request scheme, hostname and port that
78
82
  # the server uses to identify itself. This is used when creating
@@ -81,7 +85,7 @@
81
85
  # match this virtual host. For the default virtual host (this file) this
82
86
  # value is not decisive as it is used as a last resort host regardless.
83
87
  # However, you must set it for any further virtual host explicitly.
84
- #ServerName www.example.com
88
+ ServerName local.test.com
85
89
 
86
90
  ServerAdmin webmaster@localhost
87
91
  DocumentRoot /home/test/html
@@ -114,16 +118,15 @@
114
118
  ### やってみたこと1
115
119
  http://localhost:8000/にアクセス。
116
120
  結果
117
- Forbidden
121
+ アクセスできる
118
- You don't have permission to access this resource.
119
122
 
120
123
  ### やってみたこと2
121
- 000-default.confのServerNameをtest.com
124
+ local.test.comにアクセス。
125
+ 結果
122
- Forbidden
126
+ アクセスできない
123
- You don't have permission to access this resource.
124
127
 
128
+ 困っていること
129
+ ServerNameを好きなドメイン名に変更した後になにか設定があるのか?
130
+ hostsファイルの設定が必要?
125
131
 
126
- 困っていること
127
- http://localhost:8000/にアクセスするもアクセスができない。
128
- DocumentRootを/var/www/hrmlで配下にindex.htmlを設置すると問題なくアクセスできる。
129
132
  よろしくお願いいたします。