2017-08-14 74 views
0

該場景是我已經在aws上創建了一個實例,並且克隆了我的rails項目,並在localhost:3000上使用rails s命令運行。並且服務器正在使用PUMA運行。rails puma nginx開發模式localhost

現在我想看到的公共DNS是http://ec2-13-56-156-255.us-west-1.compute.amazonaws.com/

對我有安裝nginx的Web服務器和我能看到nginx的默認索引頁,但是當我提出變更運行我的應用程序看到我的應用程序在nginx.conf文件中給我403錯誤。變化如下。

文件路徑:/etc/nginx/nginx.conf


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 { 
    } 

+0

你嘗試從像控制檯運行軌軌's'? – kunashir

+0

是在aws實例上從控制檯輸入@kunashir。 –

+0

嘗試'rails s -b 0.0.0.0' – kunashir

回答