Mercurial > hg > nginx-site
comparison xml/ja/docs/http/converting_rewrite_rules.xml @ 490:9913f1d51c07
Replaced "nginx" domain names with example domains.
author | Ruslan Ermilov <ru@nginx.com> |
---|---|
date | Thu, 19 Apr 2012 12:30:24 +0000 |
parents | 7db449e89e92 |
children | 130fad6dc1b4 |
comparison
equal
deleted
inserted
replaced
489:2abd1998a0cc | 490:9913f1d51c07 |
---|---|
8 | 8 |
9 <para> | 9 <para> |
10 共有のホスティングで Apache の .htaccess ファイル<i>のみ</i>で<i>すべて</i>を設定してきたのなら、次のようにルールをコンバートします: | 10 共有のホスティングで Apache の .htaccess ファイル<i>のみ</i>で<i>すべて</i>を設定してきたのなら、次のようにルールをコンバートします: |
11 | 11 |
12 <programlisting> | 12 <programlisting> |
13 RewriteCond %{HTTP_HOST} nginx.org | 13 RewriteCond %{HTTP_HOST} example.org |
14 RewriteRule (.*) http://www.nginx.org$1 | 14 RewriteRule (.*) http://www.example.org$1 |
15 </programlisting> | 15 </programlisting> |
16 | 16 |
17 上記は下記のようになります: | 17 上記は下記のようになります: |
18 | 18 |
19 <programlisting> | 19 <programlisting> |
20 server { | 20 server { |
21 listen 80; | 21 listen 80; |
22 server_name www.nginx.org nginx.org; | 22 server_name www.example.org example.org; |
23 if ($http_host = nginx.org) { | 23 if ($http_host = example.org) { |
24 rewrite (.*) http://www.nginx.org$1; | 24 rewrite (.*) http://www.example.org$1; |
25 } | 25 } |
26 ... | 26 ... |
27 } | 27 } |
28 </programlisting> | 28 </programlisting> |
29 </para> | 29 </para> |
30 | 30 |
31 <para> | 31 <para> |
32 これは間違っていて面倒で非効率的な方法です。正しい方法は <url>nginx.org</url> 用に別のサーバを定義します: | 32 これは間違っていて面倒で非効率的な方法です。正しい方法は <url>example.org</url> 用に別のサーバを定義します: |
33 | 33 |
34 <programlisting> | 34 <programlisting> |
35 server { | 35 server { |
36 listen 80; | 36 listen 80; |
37 server_name nginx.org; | 37 server_name example.org; |
38 rewrite ^ http://www.nginx.org$request_uri?; | 38 rewrite ^ http://www.example.org$request_uri?; |
39 } | 39 } |
40 | 40 |
41 server { | 41 server { |
42 listen 80; | 42 listen 80; |
43 server_name www.nginx.org; | 43 server_name www.example.org; |
44 ... | 44 ... |
45 } | 45 } |
46 </programlisting> | 46 </programlisting> |
47 </para> | 47 </para> |
48 | 48 |
50 | 50 |
51 | 51 |
52 <section> | 52 <section> |
53 | 53 |
54 <para> | 54 <para> |
55 別の例として、<url>nginx.com</url> 以外と <url>www.nginx.com</url> 以外のすべて、という後方ロジックの代わりの例です: | 55 別の例として、<url>example.com</url> 以外と <url>www.example.com</url> 以外のすべて、という後方ロジックの代わりの例です: |
56 | 56 |
57 <programlisting> | 57 <programlisting> |
58 RewriteCond %{HTTP_HOST} !nginx.com | 58 RewriteCond %{HTTP_HOST} !example.com |
59 RewriteCond %{HTTP_HOST} !www.nginx.com | 59 RewriteCond %{HTTP_HOST} !www.example.com |
60 RewriteRule (.*) http://www.nginx.com$1 | 60 RewriteRule (.*) http://www.example.com$1 |
61 </programlisting> | 61 </programlisting> |
62 | 62 |
63 この場合、単に <url>nginx.com</url>、<url>www.nginx.com</url>、そしてそれ以外を定義します: | 63 この場合、単に <url>example.com</url>、<url>www.example.com</url>、そしてそれ以外を定義します: |
64 | 64 |
65 | 65 |
66 <programlisting> | 66 <programlisting> |
67 server { | 67 server { |
68 listen 80; | 68 listen 80; |
69 server_name nginx.org www.nginx.org; | 69 server_name example.org www.example.org; |
70 ... | 70 ... |
71 } | 71 } |
72 | 72 |
73 server { | 73 server { |
74 listen 80 default_server; | 74 listen 80 default_server; |
75 server_name _; | 75 server_name _; |
76 rewrite ^ http://nginx.org$request_uri?; | 76 rewrite ^ http://example.org$request_uri?; |
77 } | 77 } |
78 </programlisting> | 78 </programlisting> |
79 </para> | 79 </para> |
80 | 80 |
81 </section> | 81 </section> |