【发布时间】:2014-06-26 10:53:18
【问题描述】:
所以我使用非常标准的 NGinx 和 Thin 配置部署了我的 Rail 3 应用程序。但我遇到了三个问题 -
- 我只能通过将端口附加到 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;
}
我的瘦身:
---
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
【问题讨论】:
标签: ruby-on-rails nginx thin