質問編集履歴

7

訂正

2021/04/07 05:20

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -170,7 +170,7 @@
170
170
 
171
171
  #'url' => env('AWS_URL'),
172
172
 
173
- 'endpoint' => env('AWS_ENDPOINT'),
173
+ #'endpoint' => env('AWS_ENDPOINT'),
174
174
 
175
175
  ],
176
176
 

6

訂正

2021/04/07 05:20

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -12,6 +12,10 @@
12
12
 
13
13
  踏み台サーバーからSSH接続をして、2台のwebサーバー(Private1,2)に接続をして、
14
14
 
15
+ ```php
16
+
17
+
18
+
15
19
  $cd /var/www/html/laravel-app
16
20
 
17
21
  $sudo vim .env 
@@ -28,17 +32,15 @@
28
32
 
29
33
  AWS_BUCKET=AAAAAAA
30
34
 
31
-
32
-
33
-
34
-
35
35
  -----------------------------------------
36
36
 
37
+
38
+
37
39
  $php artisan config:clear
38
40
 
39
41
  $php artisan cache:clear
40
42
 
41
-
43
+ ```
42
44
 
43
45
  ### 発生している問題・エラーメッセージ
44
46
 
@@ -166,7 +168,7 @@
166
168
 
167
169
  'bucket' => env('AWS_BUCKET'),
168
170
 
169
- 'url' => env('AWS_URL'),
171
+ #'url' => env('AWS_URL'),
170
172
 
171
173
  'endpoint' => env('AWS_ENDPOINT'),
172
174
 

5

訂正

2021/04/07 03:13

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -30,6 +30,8 @@
30
30
 
31
31
 
32
32
 
33
+
34
+
33
35
  -----------------------------------------
34
36
 
35
37
  $php artisan config:clear
@@ -54,7 +56,9 @@
54
56
 
55
57
  ### 投稿用
56
58
 
59
+ ```php
60
+
57
- public function store(PostRequest $request)
61
+ public function store(PostRequest $request)
58
62
 
59
63
  {
60
64
 
@@ -112,9 +116,17 @@
112
116
 
113
117
  }
114
118
 
119
+ ```
120
+
121
+
122
+
115
123
  ### config/filesystems.php
116
124
 
125
+
126
+
127
+ ```php
128
+
117
- 'disks' => [
129
+ 'disks' => [
118
130
 
119
131
 
120
132
 
@@ -164,6 +176,10 @@
164
176
 
165
177
  ],
166
178
 
179
+ ```
180
+
181
+
182
+
167
183
 
168
184
 
169
185
  ### それまで行っていた事

4

訂正

2021/04/07 03:05

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -112,6 +112,58 @@
112
112
 
113
113
  }
114
114
 
115
+ ### config/filesystems.php
116
+
117
+ 'disks' => [
118
+
119
+
120
+
121
+ 'local' => [
122
+
123
+ 'driver' => 'local',
124
+
125
+ 'root' => storage_path('app'),
126
+
127
+ ],
128
+
129
+
130
+
131
+ 'public' => [
132
+
133
+ 'driver' => 'local',
134
+
135
+ 'root' => storage_path('app/public'),
136
+
137
+ 'url' => env('APP_URL').'/storage',
138
+
139
+ 'visibility' => 'public',
140
+
141
+ ],
142
+
143
+
144
+
145
+ 's3' => [
146
+
147
+ 'driver' => 's3',
148
+
149
+ 'key' => env('AWS_ACCESS_KEY_ID'),
150
+
151
+ 'secret' => env('AWS_SECRET_ACCESS_KEY'),
152
+
153
+ 'region' => env('AWS_DEFAULT_REGION'),
154
+
155
+ 'bucket' => env('AWS_BUCKET'),
156
+
157
+ 'url' => env('AWS_URL'),
158
+
159
+ 'endpoint' => env('AWS_ENDPOINT'),
160
+
161
+ ],
162
+
163
+
164
+
165
+ ],
166
+
115
167
 
116
168
 
117
169
  ### それまで行っていた事

3

訂正

2021/04/07 00:57

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -52,6 +52,68 @@
52
52
 
53
53
 
54
54
 
55
+ ### 投稿用
56
+
57
+ public function store(PostRequest $request)
58
+
59
+ {
60
+
61
+
62
+
63
+ $image_file = "";
64
+
65
+ $upload_image = $request->file('image_file');
66
+
67
+
68
+
69
+ if ($upload_image) {
70
+
71
+ //$path = $upload_image->store('uploads', 'public');
72
+
73
+ $path = Storage::disk('s3')->put('/', $upload_image, 'public');
74
+
75
+ if ($path) {
76
+
77
+ //Image::make($upload_image->getRealPath())->resize(150, 150)->save();
78
+
79
+ $image = Image::make($upload_image->getRealPath());
80
+
81
+ $image->resize(150, 150);
82
+
83
+ $image->path = Storage::disk('s3')->url($path);
84
+
85
+ $image->save();
86
+
87
+ $image_file = $path;
88
+
89
+ }
90
+
91
+ }
92
+
93
+
94
+
95
+
96
+
97
+ $post = new Post;
98
+
99
+ $post->subject = $request->subject;
100
+
101
+ $post->message = $request->message;
102
+
103
+ $post->image_file = $image_file;
104
+
105
+ $post->name = "";
106
+
107
+ $post->user_id = Auth::id();
108
+
109
+ $post->save();
110
+
111
+ return redirect('/bbs')->with('poststatus', '新規投稿しました');
112
+
113
+ }
114
+
115
+
116
+
55
117
  ### それまで行っていた事
56
118
 
57
119
  ACMを利用してHTTPS通信可能にする。このあたりを問題が起きる直前に動かしていたもの

2

訂正

2021/04/06 14:21

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -76,4 +76,4 @@
76
76
 
77
77
  ### 参考記事
78
78
 
79
- [AWSデプロイ参考記事](https://qiita.com/minato-naka/items/ddb5f5301f9f590cdcbf)
79
+ [AWS環境構築参考記事](https://qiita.com/minato-naka/items/ddb5f5301f9f590cdcbf)

1

訂正

2021/04/06 11:19

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -76,4 +76,4 @@
76
76
 
77
77
  ### 参考記事
78
78
 
79
- https://qiita.com/minato-naka/items/ddb5f5301f9f590cdcbf
79
+ [AWSデプロイ参考記事](https://qiita.com/minato-naka/items/ddb5f5301f9f590cdcbf)