質問編集履歴
5
設定値を修正しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -100,7 +100,9 @@
|
|
100
100
|
|
101
101
|
add_header Access-Control-Allow-Credentials true;
|
102
102
|
|
103
|
-
try_files $uri @hogehoge;
|
103
|
+
#try_files $uri @hogehoge;
|
104
|
+
|
105
|
+
try_files $uri $uri/ @hogehoge; # ここを追記しました。
|
104
106
|
|
105
107
|
}
|
106
108
|
|
4
編集
test
CHANGED
File without changes
|
test
CHANGED
@@ -106,13 +106,17 @@
|
|
106
106
|
|
107
107
|
```
|
108
108
|
|
109
|
-
###
|
109
|
+
### 確認したこと
|
110
110
|
|
111
111
|
|
112
112
|
|
113
113
|
・ファイルに読み取り権限が付いている(ステージングと同じ)
|
114
114
|
|
115
|
-
・ドキュメントルートの
|
115
|
+
・ドキュメントルートの各ディレクトリにx,r権限が付いている(ステージングと同じ)
|
116
|
+
|
117
|
+
・selinuxは無効になっている
|
118
|
+
|
119
|
+
・/etc/nginx/conf.d/配下の別の設定ファイルが読み込まれてはいない
|
116
120
|
|
117
121
|
|
118
122
|
|
3
編集
test
CHANGED
File without changes
|
test
CHANGED
@@ -86,25 +86,21 @@
|
|
86
86
|
|
87
87
|
|
88
88
|
|
89
|
-
return 301 https://$host$request_uri;
|
90
|
-
|
91
|
-
|
92
|
-
|
93
89
|
location / {
|
94
90
|
|
95
91
|
return 301 https://$host$request_uri
|
96
92
|
|
97
|
-
root /home/hogeuser/DocumentRoot/hoge_public;
|
93
|
+
root /home/hogeuser/DocumentRoot/hoge_public;
|
98
94
|
|
99
|
-
add_header Access-Control-Allow-Origin "*";
|
95
|
+
add_header Access-Control-Allow-Origin "*";
|
100
96
|
|
101
|
-
add_header Access-Control-Allow-Methods "POST, GET, OPTIONS";
|
97
|
+
add_header Access-Control-Allow-Methods "POST, GET, OPTIONS";
|
102
98
|
|
103
|
-
add_header Access-Control-Allow-Headers "Origin, Authorization, Accept";
|
99
|
+
add_header Access-Control-Allow-Headers "Origin, Authorization, Accept";
|
104
100
|
|
105
|
-
add_header Access-Control-Allow-Credentials true;
|
101
|
+
add_header Access-Control-Allow-Credentials true;
|
106
102
|
|
107
|
-
try_files $uri @hogehoge;
|
103
|
+
try_files $uri @hogehoge;
|
108
104
|
|
109
105
|
}
|
110
106
|
|
2
更新
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,24 +1,50 @@
|
|
1
|
-
###
|
1
|
+
### 事象
|
2
2
|
|
3
3
|
|
4
4
|
|
5
|
-
・ドキュメントルートを設定
|
5
|
+
・ドキュメントルートを追加した設定ファイルがあり、hoge_publicディレクトリを作成した際に~/にアクセスすると403エラーとなります。
|
6
6
|
|
7
|
+
|
8
|
+
|
7
|
-
・ス
|
9
|
+
・ディレクトリ配下にsitemap.xmlを配置した状態でも~/にアクセスすると403エラー、この状態で~/sitemap.xmlにアクセスするとファイルの中身が正常に表示される。
|
10
|
+
|
11
|
+
|
8
12
|
|
9
13
|
・/hoge_piublic配下にsitemap.xmlを配置した場合、~/sitemap.xmlとアクセスすれば正常に表示される。
|
10
14
|
|
15
|
+
→/home/hogeuser/DocumentRoot/hoge_publicは参照できている
|
11
16
|
|
12
17
|
|
13
|
-
### 発生している問題・エラーメッセージ
|
14
18
|
|
19
|
+
・設定を追加した状態でもディレクトリを作成しない状態であれば、~/でトップページ(@hogehoge)が正常に表示される。
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
### エラー
|
24
|
+
|
15
|
-
error.logには下記のようなファイルが存在しないエラーが数十行表示されており、意図した場所を参照しておらず、そこには該当ファイルは存在しない
|
25
|
+
error.logには下記のようなファイルが存在しないエラーが数十行表示されており、意図した場所を参照しておらず、そこには該当ファイルは存在しない状態です。
|
26
|
+
|
27
|
+
エラーのパスはnginxデフォルトのパスのため、ファイルが見つからず、フォールバックしていると思われます。
|
16
28
|
|
17
29
|
```
|
18
30
|
|
19
31
|
/usr/share/nginx/html/hoge.html" failed (2: No such file or directory),
|
20
32
|
|
21
33
|
```
|
34
|
+
|
35
|
+
### 想定される原因
|
36
|
+
|
37
|
+
・意図した場所を参照していないため、設定ファイルの書き方が間違っている
|
38
|
+
|
39
|
+
→~/sitemap.xmlでアクセスできているので、ドキュメントルートの設定は合っており、動作しているはずなのですが。。
|
40
|
+
|
41
|
+
・権限の問題
|
42
|
+
|
43
|
+
→ディレクトリはドキュメントルートへのすべてのディレクトリでx,r権限が付与されている。~/sitemap.xmlでアクセスできているので権限は問題ないかと思っているのですが。。
|
44
|
+
|
45
|
+
・OS設定の問題
|
46
|
+
|
47
|
+
→selinuxが原因の場合もある情報がありましたが、無効になっています。
|
22
48
|
|
23
49
|
|
24
50
|
|
1
設定ファイルを追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -25,6 +25,44 @@
|
|
25
25
|
### 設定ファイル
|
26
26
|
|
27
27
|
```
|
28
|
+
|
29
|
+
server {
|
30
|
+
|
31
|
+
listen 80;
|
32
|
+
|
33
|
+
server_name hogehoge.com; # ステージングと同じドメイン名となっている
|
34
|
+
|
35
|
+
access_log /home/kusanagi/hogehoge/log/nginx/access.log main;
|
36
|
+
|
37
|
+
error_log /home/kusanagi/hogehoge/log/nginx/error.log warn;
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
# rewrite ^(.*)$ https://hogehoge.com$request_uri permanent;
|
42
|
+
|
43
|
+
charset UTF-8;
|
44
|
+
|
45
|
+
client_max_body_size 16M;
|
46
|
+
|
47
|
+
root /home/kusanagi/hogehoge.com/DocumentRoot;
|
48
|
+
|
49
|
+
index index.php index.html index.htm;
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
|
54
|
+
|
55
|
+
rewrite ^/hogeA(.*)$ http://hogehoge.com/hogeA$1 permanent;
|
56
|
+
|
57
|
+
rewrite ^/hogeB(.*)$ http://hogehoge.com/hogeB$1 permanent;
|
58
|
+
|
59
|
+
rewrite ^/hogeC(.*)$ http://hogehoge.com/hogeC$1 permanent;
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
return 301 https://$host$request_uri;
|
64
|
+
|
65
|
+
|
28
66
|
|
29
67
|
location / {
|
30
68
|
|