Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 如果URL中没有端口,则无法访问NGinx和Thin上的Rails应用程序_Ruby On Rails_Nginx_Thin - Fatal编程技术网

Ruby on rails 如果URL中没有端口,则无法访问NGinx和Thin上的Rails应用程序

Ruby on rails 如果URL中没有端口,则无法访问NGinx和Thin上的Rails应用程序,ruby-on-rails,nginx,thin,Ruby On Rails,Nginx,Thin,因此,我部署了我的Rail 3应用程序,采用了相当标准的NGinx和精简配置。但我有三个问题- 我只能通过将端口附加到URL(domain.com:port)来访问应用程序 www.domain.com仍然显示NGinx欢迎屏幕和 使用URL中的端口访问应用程序在理想情况下不起作用 我的NGinx配置: upstream thin_cluster { <ip_address>:3000; <ip_address>:3001; <ip_ad

因此,我部署了我的Rail 3应用程序,采用了相当标准的NGinx和精简配置。但我有三个问题-

  • 我只能通过将端口附加到URL(domain.com:port)来访问应用程序
  • www.domain.com仍然显示NGinx欢迎屏幕和
  • 使用URL中的端口访问应用程序在理想情况下不起作用
我的NGinx配置:

upstream thin_cluster {
    <ip_address>:3000;
    <ip_address>:3001;
    <ip_address>:3002;
}

server {
        listen       80;
        server_name  domain.com www.domain.com;

        root /home/deployer/apps/appname/current/public;

        location ^~ /assets/ {
        gzip_static on;
        gzip_disable "msie6";
        expires max;
        add_header Cache-Control public;
        }

        location / {
                try_files $uri @thin;
        }   

        location @thin {
        proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        proxy_pass http://thin_cluster;
        }

        error_page   500 502 503 504 /500.html;

        client_max_body_size 50M;
        keepalive_timeout 10;
}

好吧,第无数次回答我的问题。这是一个相当愚蠢的错误,可能是因为睡眠不足

问题就在这里

上游精简集群{
:3000;
:3001;
:3002;
}

它应该包含运行精简的本地主机地址。这就是:

上游精简集群{
127.0.0.1:3000;
127.0.0.1:3001;
127.0.0.1:3002;
}


但是,我仍然可以通过附加端口号来访问该应用程序。理想情况下,这应该重定向到正确的URL。也许
proxy\u redirect
有帮助?

您需要对本地端口设置防火墙或使用套接字连接方案。
---
chdir: /home/deployer/apps/appname/current
environment: production
address: 0.0.0.0
port: 3000
timeout: 30
log: log/thin.log
pid: tmp/pids/thin.pid
max_conns: 1024
max_persistent_conns: 100
require: []
wait: 30
servers: 3
daemonize: true
onebyone: true