回答編集履歴
1
追記
answer
CHANGED
@@ -1,4 +1,16 @@
|
|
1
1
|
「/test/」のプロキシ「http://127.0.0.1:80」は nginx 自身ですか?
|
2
2
|
「/test/foo.html」→「http://127.0.0.1:80/test/foo.html」となるので、バーチャルホストで分けているのでなければ、ループするのではないでしょうか。
|
3
3
|
|
4
|
-
「http://127.0.0.1:80/」(最後にスラッシュあり)であれば、パスを変換しますので、「/test/foo.html」→「http://127.0.0.1:80/foo.html」→location / で処理→「192.168.0.2:80/foo.html」となります。
|
4
|
+
「http://127.0.0.1:80/」(最後にスラッシュあり)であれば、パスを変換しますので、「/test/foo.html」→「http://127.0.0.1:80/foo.html」→location / で処理→「192.168.0.2:80/foo.html」となります。
|
5
|
+
|
6
|
+
###(2016/08/20 00:16) 追記
|
7
|
+
「http://127.0.0.1/:80」だと余計おかしくなりませんか?
|
8
|
+
|
9
|
+
「/test/」でローカルの「/var/www/」ディレクトリ以下を参照したいということであれば、リバースプロキシーにするのではなく、root や alias でディレクトリを指定すればいいと思います。
|
10
|
+
```
|
11
|
+
(設定例)
|
12
|
+
location /test/ {
|
13
|
+
alias /var/www/;
|
14
|
+
index index.html index.htm;
|
15
|
+
}
|
16
|
+
```
|