回答編集履歴
6
修正
test
CHANGED
@@ -272,7 +272,7 @@
|
|
272
272
|
|
273
273
|
config.vm.network "forwarded_port", guest: 80, host: 8080
|
274
274
|
|
275
|
-
config.vm.synced_folder "./
|
275
|
+
config.vm.synced_folder "./", "/var/www/html" # ←追記
|
276
276
|
|
277
277
|
end
|
278
278
|
|
@@ -292,7 +292,7 @@
|
|
292
292
|
|
293
293
|
|
294
294
|
|
295
|
-
すると
|
295
|
+
すると `Vagrantfile` が置かれているフォルダが仮想マシンの `/var/www/html` とシンクロするはずです。
|
296
296
|
|
297
297
|
|
298
298
|
|
5
追記3
test
CHANGED
@@ -249,3 +249,51 @@
|
|
249
249
|
`PHP INFO` ページが確認できれば、後は自力でできそうではないですか?
|
250
250
|
|
251
251
|
如何でしょうか?
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
# 追記3
|
256
|
+
|
257
|
+
> 自分で作成したファイルをphptestフォルダに入れたいのですがこれはどこにあるのでしょうか?
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
Macと仮想マシン間で **ストレージの同期** を行う必要があります。
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
`Vagrantfile` に `config.vm.synced_folder` を追記します。
|
266
|
+
|
267
|
+
```
|
268
|
+
|
269
|
+
Vagrant.configure("2") do |config|
|
270
|
+
|
271
|
+
config.vm.box = "ubuntu/trusty64"
|
272
|
+
|
273
|
+
config.vm.network "forwarded_port", guest: 80, host: 8080
|
274
|
+
|
275
|
+
config.vm.synced_folder "./html", "/var/www/html" # ←追記
|
276
|
+
|
277
|
+
end
|
278
|
+
|
279
|
+
```
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
仮想マシンを再起動して設定を反映。
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
```
|
288
|
+
|
289
|
+
vagrant reload --provision
|
290
|
+
|
291
|
+
```
|
292
|
+
|
293
|
+
|
294
|
+
|
295
|
+
するとMac上に `html` フォルダができて、中身が仮想マシンの `/var/www/html` とシンクロするはずです。
|
296
|
+
|
297
|
+
|
298
|
+
|
299
|
+
[http://laraweb.net/environment/84/](http://laraweb.net/environment/84/)
|
4
修正
test
CHANGED
@@ -80,13 +80,13 @@
|
|
80
80
|
|
81
81
|
# 追記2
|
82
82
|
|
83
|
-
私の環境でもPHPを入れました。
|
83
|
+
私の仮想環境でもPHPを入れました。
|
84
|
-
|
85
|
-
|
86
|
-
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
-
```
|
87
|
+
```
|
88
|
-
|
88
|
+
|
89
|
-
sudo apt install -y php5 # とりあえずphp5を入れました
|
89
|
+
$ sudo apt install -y php5 # とりあえずphp5を入れました
|
90
90
|
|
91
91
|
```
|
92
92
|
|
@@ -224,7 +224,7 @@
|
|
224
224
|
|
225
225
|
```
|
226
226
|
|
227
|
-
sudo chmod 777 -R /var/www/html
|
227
|
+
$ sudo chmod 777 -R /var/www/html
|
228
228
|
|
229
229
|
```
|
230
230
|
|
3
追記2
test
CHANGED
@@ -75,3 +75,177 @@
|
|
75
75
|
`localhost:8080` をブラウザで見る→ `Apace2 Ubuntu Default Page` が表示される
|
76
76
|
|
77
77
|
まずはここまで確認して下さい。
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
# 追記2
|
82
|
+
|
83
|
+
私の環境でもPHPを入れました。
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
```
|
88
|
+
|
89
|
+
sudo apt install -y php5 # とりあえずphp5を入れました
|
90
|
+
|
91
|
+
```
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
apacheの設定ファイルは `/etc/apache2` 配下にあります。
|
96
|
+
|
97
|
+
今回チェックしないといけないのは `/etc/apache2/sites-enabled/000-default.conf` です。
|
98
|
+
|
99
|
+
見てみましょう。
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
```
|
104
|
+
|
105
|
+
$ cat /etc/apache2/sites-enabled/000-default.conf
|
106
|
+
|
107
|
+
<VirtualHost *:80>
|
108
|
+
|
109
|
+
# The ServerName directive sets the request scheme, hostname and port that
|
110
|
+
|
111
|
+
# the server uses to identify itself. This is used when creating
|
112
|
+
|
113
|
+
# redirection URLs. In the context of virtual hosts, the ServerName
|
114
|
+
|
115
|
+
# specifies what hostname must appear in the request's Host: header to
|
116
|
+
|
117
|
+
# match this virtual host. For the default virtual host (this file) this
|
118
|
+
|
119
|
+
# value is not decisive as it is used as a last resort host regardless.
|
120
|
+
|
121
|
+
# However, you must set it for any further virtual host explicitly.
|
122
|
+
|
123
|
+
#ServerName www.example.com
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
ServerAdmin webmaster@localhost
|
128
|
+
|
129
|
+
DocumentRoot /var/www/html
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
|
134
|
+
|
135
|
+
# error, crit, alert, emerg.
|
136
|
+
|
137
|
+
# It is also possible to configure the loglevel for particular
|
138
|
+
|
139
|
+
# modules, e.g.
|
140
|
+
|
141
|
+
#LogLevel info ssl:warn
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
ErrorLog ${APACHE_LOG_DIR}/error.log
|
146
|
+
|
147
|
+
CustomLog ${APACHE_LOG_DIR}/access.log combined
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
# For most configuration files from conf-available/, which are
|
152
|
+
|
153
|
+
# enabled or disabled at a global level, it is possible to
|
154
|
+
|
155
|
+
# include a line for only one particular virtual host. For example the
|
156
|
+
|
157
|
+
# following line enables the CGI configuration for this host only
|
158
|
+
|
159
|
+
# after it has been globally disabled with "a2disconf".
|
160
|
+
|
161
|
+
#Include conf-available/serve-cgi-bin.conf
|
162
|
+
|
163
|
+
</VirtualHost>
|
164
|
+
|
165
|
+
```
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
ワーッと出てきてよく分からないと思いますが、見るべきは `DocumentRoot` という項目です。
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
```
|
174
|
+
|
175
|
+
DocumentRoot /var/www/html
|
176
|
+
|
177
|
+
```
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
`/var/www/html` とあります。
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
ここにファイルを置くとサーバが見てくれます。
|
186
|
+
|
187
|
+
すでにここには `index.html` があります。
|
188
|
+
|
189
|
+
先程の `Apace2 Ubuntu Default Page` を表示するhtmlファイルですね。
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
```
|
194
|
+
|
195
|
+
$ ls /var/www/html/index.html
|
196
|
+
|
197
|
+
index.html # ←Apace2 Ubuntu Default Page用のファイル
|
198
|
+
|
199
|
+
```
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
実際に動作確認してみます。
|
204
|
+
|
205
|
+
`/var/www/html` 下に `phptest` というフォルダを作ります。
|
206
|
+
|
207
|
+
この下にテストファイルを置きます。
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
```
|
212
|
+
|
213
|
+
$ sudo mkdir /var/www/html/phptest
|
214
|
+
|
215
|
+
```
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
で、テスト用のPHPファイルを作りますが、その前に `html` フォルダ以下の権限を緩めておきます。
|
220
|
+
|
221
|
+
これは危険な設定なので外部に公開する本番サーバではNGです。
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
```
|
226
|
+
|
227
|
+
sudo chmod 777 -R /var/www/html
|
228
|
+
|
229
|
+
```
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
`phpinfo.php` ファイルを作成します。
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
```
|
238
|
+
|
239
|
+
$ echo "<?php phpinfo();" > /var/www/html/phptest/phpinfo.php
|
240
|
+
|
241
|
+
```
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
これでファイルが作成できました。
|
246
|
+
|
247
|
+
では、ブラウザから `localhost:8080/phptest/phpinfo.php` を見て下さい。
|
248
|
+
|
249
|
+
`PHP INFO` ページが確認できれば、後は自力でできそうではないですか?
|
250
|
+
|
251
|
+
如何でしょうか?
|
2
修正
test
CHANGED
@@ -62,11 +62,11 @@
|
|
62
62
|
|
63
63
|
$ sudo apt install -y apache2
|
64
64
|
|
65
|
-
$ sudo apachectl sta
|
65
|
+
$ sudo apachectl status
|
66
66
|
|
67
67
|
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 10.0.2.15. Set the 'ServerName' directive globally to suppress this message
|
68
68
|
|
69
|
-
httpd (pid 2831) already running
|
69
|
+
httpd (pid 2831) already running # ←already runningが出ているかを確認しましょう
|
70
70
|
|
71
71
|
```
|
72
72
|
|
1
追記
test
CHANGED
@@ -1,3 +1,77 @@
|
|
1
1
|
apacheは起動できているか?
|
2
2
|
|
3
3
|
apacheのdocument root設定は適切か?を確認する必要があります。
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
# 追記
|
8
|
+
|
9
|
+
私の手元で試しました。
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
`Vagrantfile`
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
```
|
18
|
+
|
19
|
+
# -*- mode: ruby -*-
|
20
|
+
|
21
|
+
# vi: set ft=ruby :
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
# All Vagrant configuration is done below. The "2" in Vagrant.configure
|
26
|
+
|
27
|
+
# configures the configuration version (we support older styles for
|
28
|
+
|
29
|
+
# backwards compatibility). Please don't change it unless you know what
|
30
|
+
|
31
|
+
# you're doing.
|
32
|
+
|
33
|
+
Vagrant.configure("2") do |config|
|
34
|
+
|
35
|
+
config.vm.box = "ubuntu/trusty64"
|
36
|
+
|
37
|
+
config.vm.network "forwarded_port", guest: 80, host: 8080
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
```
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
```
|
46
|
+
|
47
|
+
vagrant up
|
48
|
+
|
49
|
+
vagrant ssh
|
50
|
+
|
51
|
+
```
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
仮想マシンの中に入ったら、以下を順に実行。
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
```
|
60
|
+
|
61
|
+
$ sudo apt update -y
|
62
|
+
|
63
|
+
$ sudo apt install -y apache2
|
64
|
+
|
65
|
+
$ sudo apachectl start
|
66
|
+
|
67
|
+
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 10.0.2.15. Set the 'ServerName' directive globally to suppress this message
|
68
|
+
|
69
|
+
httpd (pid 2831) already running
|
70
|
+
|
71
|
+
```
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
`localhost:8080` をブラウザで見る→ `Apace2 Ubuntu Default Page` が表示される
|
76
|
+
|
77
|
+
まずはここまで確認して下さい。
|