0
シナリオは私がaws上でインスタンスを作成し、その上に私のレールプロジェクトを作成し、localhost:3000上でrailsコマンドを使って実行するというものです。サーバーはPUMAを使用して実行されています。rails puma nginx開発モードlocalhost
今、私は私のアプリは、そのためのhttp://ec2-13-56-156-255.us-west-1.compute.amazonaws.com/
あるパブリックDNS上で実行して見たいと思って、私はnginxのWebサーバーをインストールしていて、私はnginxのデフォルトのインデックスページを見ることができるが、私はへの変更を作っていますnginx.confファイルで私のアプリを見て、それは私に403エラーを与えています。変更は以下の通りです。
ファイルパス:
user ec2-user;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /var/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;
index index.html index.htm;
upstream app {
server 127.0.0.1:3000;
#server unix:///path_to_my_app/tmp/sockets/puma.sock fail_timeout=0;
}
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name 13.56.156.255;
root /home/ec2-user/Projects/aqua_web_v1.0;
#root /usr/share/nginx/html;
#location/{
#}
location @app {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://app;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
あなたはレールのS' 'のようなコンソールから実行するレールをしようとしていますか? – kunashir
yes awsインスタンスのコンソールからの@kunashir。 –
'rails s -b 0.0.0.0'を試してください – kunashir