我使用 Screencast 335 部署到 VPS 教程成功地设置了一个 rails 站点。现在我想在新域上添加另一个 Rails 应用程序,但我对所需的步骤感到困惑。
在上述设置中,sites-available 或 /etc/nginx/nginx.conf 没有任何更改。唯一的配置在我的应用程序配置目录中的 unicorn.rb、unicorn_init.sh 和 nginx.conf 中。nginx.conf 文件如下所示:-
upstream unicorn {
server unix:/tmp/unicorn.my_app.sock fail_timeout=0;
}
server {
listen 80 default deferred;
# server_name my_app.com.au www.my_app.com.au;
root /var/www/my_app/current/public;
location ^~ /assets/ {
gzip_static on;
expires max;
add_header Cache-Control public;
}
try_files $uri/index.html $uri @unicorn;
location @unicorn {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://unicorn;
}
error_page 500 502 503 504 /500.html;
client_max_body_size 4G;
keepalive_timeout 10;
}
在我的 Capistrano 食谱中,我有这条线
sudo "ln -nfs #{current_path}/config/nginx.conf /etc/nginx/sites-enabled/#{application}"
添加第二个域仅仅是在侦听和取消注释 server_name 部分后删除默认延迟,然后为第二个应用程序使用不同的上游套接字名称和服务器名称重复此配置文件?这会起作用还是我需要将此文件传输到可用站点并创建指向已启用站点的符号链接?