teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

文章の修正

2021/12/08 07:15

投稿

Ko-program
Ko-program

スコア11

title CHANGED
File without changes
body CHANGED
@@ -6,14 +6,14 @@
6
6
  こちらのサイトの「本番環境構築」の「Nginxのインストール」まで進めたのですが、
7
7
 
8
8
  *以下設定ファイルの内容
9
- # log directory
9
+ log directory
10
10
  error_log /var/www/rails/アプリ名/log/nginx.error.log;
11
11
  access_log /var/www/rails/アプリ名/log/nginx.access.log;
12
12
 
13
- # max body size
13
+ max body size
14
14
  client_max_body_size 2G;
15
15
  upstream app_server {
16
- # for UNIX domain socket setups
16
+ for UNIX domain socket setups
17
17
  server unix:/var/www/rails/アプリ名/run/sockets/unicorn.sock fail_timeout=0;
18
18
  }
19
19
  server {
@@ -21,23 +21,23 @@
21
21
 
22
22
  server_name ; ElasticIP;
23
23
 
24
- # nginx so increasing this is generally safe...
24
+ nginx so increasing this is generally safe...
25
25
  keepalive_timeout 5;
26
- # path for static files
26
+ path for static files
27
27
  root /var/www/rails/アプリ名/public;
28
28
 
29
- # page cache loading
29
+ page cache loading
30
30
  try_files $uri/index.html $uri.html $uri @app;
31
31
 
32
32
  location @app {
33
- # HTTP headers
33
+ HTTP headers
34
34
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
35
35
  proxy_set_header Host $http_host;
36
36
  proxy_redirect off;
37
37
  proxy_pass http://app_server;
38
38
  }
39
39
 
40
- # Rails error pages
40
+ Rails error pages
41
41
  error_page 500 502 503 504 /500.html;
42
42
  location = /500.html {
43
43
  root /var/www/rails/アプリ名/public;

1

ファイルの内容の追記

2021/12/08 07:15

投稿

Ko-program
Ko-program

スコア11

title CHANGED
File without changes
body CHANGED
@@ -4,6 +4,46 @@
4
4
  AWSサービスを連携してデプロイしようとしています。
5
5
 
6
6
  こちらのサイトの「本番環境構築」の「Nginxのインストール」まで進めたのですが、
7
+
8
+ *以下設定ファイルの内容
9
+ # log directory
10
+ error_log /var/www/rails/アプリ名/log/nginx.error.log;
11
+ access_log /var/www/rails/アプリ名/log/nginx.access.log;
12
+
13
+ # max body size
14
+ client_max_body_size 2G;
15
+ upstream app_server {
16
+ # for UNIX domain socket setups
17
+ server unix:/var/www/rails/アプリ名/run/sockets/unicorn.sock fail_timeout=0;
18
+ }
19
+ server {
20
+ listen 80;
21
+
22
+ server_name ; ElasticIP;
23
+
24
+ # nginx so increasing this is generally safe...
25
+ keepalive_timeout 5;
26
+ # path for static files
27
+ root /var/www/rails/アプリ名/public;
28
+
29
+ # page cache loading
30
+ try_files $uri/index.html $uri.html $uri @app;
31
+
32
+ location @app {
33
+ # HTTP headers
34
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
35
+ proxy_set_header Host $http_host;
36
+ proxy_redirect off;
37
+ proxy_pass http://app_server;
38
+ }
39
+
40
+ # Rails error pages
41
+ error_page 500 502 503 504 /500.html;
42
+ location = /500.html {
43
+ root /var/www/rails/アプリ名/public;
44
+ }
45
+ }
46
+
7
47
  その中の設定ファイルの作成した後に、ファイルの設定内容をNginxに反映させて再起動しようとしたものの、
8
48
 
9
49
  [ec2-user@ ~]$ sudo systemctl restart nginx