Ruby on rails 如何使用Puma和Nginx部署rails应用程序
我一直在遵循这一点来部署rails 4应用程序,但由于无法正常工作而陷入困境 第一点:我还没有使用域名,只是一个IP号码 第二点:我使用了default.conf nginx文件,如下所示:Ruby on rails 如何使用Puma和Nginx部署rails应用程序,ruby-on-rails,nginx,puma,Ruby On Rails,Nginx,Puma,我一直在遵循这一点来部署rails 4应用程序,但由于无法正常工作而陷入困境 第一点:我还没有使用域名,只是一个IP号码 第二点:我使用了default.conf nginx文件,如下所示: upstream turing { server unix:///var/run/turing.sock; } server { listen 80; server_name localhost; # change to match your URL root /var/www/turin
upstream turing {
server unix:///var/run/turing.sock;
}
server {
listen 80;
server_name localhost; # change to match your URL
root /var/www/turing/public; # I assume your app is located at that location
location / {
proxy_pass http://turing; # match the name of upstream directive which is defined above
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location ~* ^/assets/ {
# Per RFC2616 - 1 year maximum expiry
expires 1y;
add_header Cache-Control public;
# Some browsers still send conditional-GET requests if there's a
# Last-Modified header or an ETag header even if they haven't
# reached the expiry date sent in the Expires header.
add_header Last-Modified "";
add_header ETag "";
break;
}
}
当我访问ip地址时,我被重定向到ip地址,并得到一个不可用的页面
如果我正常启动应用程序rails s并访问ipnumber:3000,应用程序将按预期工作
有人能告诉我我错过了什么吗
非常感谢1注释服务器名称指令。2检查Puma是否打开.sock文件。如何检查Puma是否打开.sock文件?检查该文件是否存在,并检查您在Puma config.rb file Check bind指令中是否正确配置了它。我在哪里可以找到config.rb文件?我的应用程序中没有它。。。或按说明使用命令行参数配置绑定。