質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.46%
nginx

nginixは軽量で高性能なwebサーバーの1つです。BSD-likeライセンスのもとリリースされており、あわせてHTTPサーバ、リバースプロキシ、メールプロキシの機能も備えています。MacOSX、Windows、Linux、上で動作します。

Python

Pythonは、コードの読みやすさが特徴的なプログラミング言語の1つです。 強い型付け、動的型付けに対応しており、後方互換性がないバージョン2系とバージョン3系が使用されています。 商用製品の開発にも無料で使用でき、OSだけでなく仮想環境にも対応。Unicodeによる文字列操作をサポートしているため、日本語処理も標準で可能です。

React.js

Reactは、アプリケーションのインターフェースを構築するためのオープンソースJavaScriptライブラリです。

Q&A

0回答

1038閲覧

nginxでreactのデプロイができません。

r_k_

総合スコア5

nginx

nginixは軽量で高性能なwebサーバーの1つです。BSD-likeライセンスのもとリリースされており、あわせてHTTPサーバ、リバースプロキシ、メールプロキシの機能も備えています。MacOSX、Windows、Linux、上で動作します。

Python

Pythonは、コードの読みやすさが特徴的なプログラミング言語の1つです。 強い型付け、動的型付けに対応しており、後方互換性がないバージョン2系とバージョン3系が使用されています。 商用製品の開発にも無料で使用でき、OSだけでなく仮想環境にも対応。Unicodeによる文字列操作をサポートしているため、日本語処理も標準で可能です。

React.js

Reactは、アプリケーションのインターフェースを構築するためのオープンソースJavaScriptライブラリです。

0グッド

0クリップ

投稿2021/06/03 09:16

###状況
簡易的なREST APIを作成し、ec2でデプロイしようとしてます。
appサーバは立ち上がるのですが、webサーバにreactでbuildしたページが反映されません。
以下にエラー内容、概要、原因に該当しそうなコードを記載いたします。
もっとこういう情報が欲しい等あったらお申し付けください。

###概要
webサーバ:nginx
appサーバ:gunicorn
db:mysql
フロント:React
バック:python(falconというフレームワークを使ってます。)

###nginx.conf

user nginx; worker_processes auto; error_log /var/log/nginx/error.log; pid /run/nginx.pid; include /usr/share/nginx/modules/*.conf; events { worker_connections 1024; } http { log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; include /etc/nginx/mime.types; default_type application/octet-stream; include /etc/nginx/conf.d/*.conf; upstream falcon_app { server 0.0.0.0:8000; } server { listen 80 default_server; listen [::]:80 default_server; server_name kaishi.no.portfolio; root /home/ec2-user/front-portfolio/build; index index.html; include /etc/nginx/default.d/*.conf; location / { client_max_body_size 50M; try_files $uri /index.html; add_header Access-Control-Allow-Methods "POST, GET, PUT, DELETE, OPTIONS"; add_header Access-Control-Allow-Headers "Origin, Authorization, Accept, Content-Type"; add_header Access-Control-Allow-Credentials true; proxy_pass http://falcon_app; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } error_page 404 /404.html; location = /40x.html { } error_page 500 502 503 504 /50x.html; location = /50x.html { } } }

###試したこと
https://www.yoheim.net/blog.php?q=20180407
上記サイトを参考にnginxを立ち上げてみたのですが、うまく動きません。
systemctl status nginx.service -lを打って出てくるエラーをググってみたのですが、
どうするのが正解か全くわかりません。
もしよろしければ、どなたかご教示いただけないでしょうか...

###systemctl status nginx.service -lで表示されるログ(エラー)

● nginx.service - The nginx HTTP and reverse proxy server Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled) Active: inactive (dead) 6月 03 08:58:54 ip-172-31-29-120.us-east-2.compute.internal systemd[1]: Stopping The nginx HTTP and reverse proxy server... 6月 03 08:58:54 ip-172-31-29-120.us-east-2.compute.internal systemd[1]: Stopped The nginx HTTP and reverse proxy server. 6月 03 08:58:59 ip-172-31-29-120.us-east-2.compute.internal systemd[1]: Starting The nginx HTTP and reverse proxy server... 6月 03 08:58:59 ip-172-31-29-120.us-east-2.compute.internal nginx[22123]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok 6月 03 08:58:59 ip-172-31-29-120.us-east-2.compute.internal nginx[22123]: nginx: configuration file /etc/nginx/nginx.conf test is successful 6月 03 08:58:59 ip-172-31-29-120.us-east-2.compute.internal systemd[1]: Failed to read PID from file /run/nginx.pid: Invalid argument 6月 03 08:58:59 ip-172-31-29-120.us-east-2.compute.internal systemd[1]: Started The nginx HTTP and reverse proxy server. 6月 03 09:06:23 ip-172-31-29-120.us-east-2.compute.internal systemd[1]: Stopping The nginx HTTP and reverse proxy server... 6月 03 09:06:23 ip-172-31-29-120.us-east-2.compute.internal systemd[1]: Stopped The nginx HTTP and reverse proxy server. 6月 03 09:06:30 ip-172-31-29-120.us-east-2.compute.internal systemd[1]: Unit nginx.service cannot be reloaded because it is inactive.

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.46%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問