- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我使用 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 部分然后为第二个应用程序使用不同的上游套接字名称和服务器名称重复此配置文件的问题吗?这行得通吗?我是否需要将此文件传输到可用站点并创建指向已启用站点的符号链接(symbolic link)?
最佳答案
在 unicorn.rb 中:
应用程序 1:
root = "/var/www/application_1/current"
working_directory root
pid "#{root}/tmp/pids/unicorn-app1.pid"
listen "/tmp/unicorn.app1.sock"
应用 2:
root = "/var/www/application_2/current"
working_directory root
pid "#{root}/tmp/pids/unicorn-app2.pid"
listen "/tmp/unicorn.app2.sock"
在 nginx.conf 中:
应用程序 1:
upstream app1_server {
server unix:/tmp/unicorn.app1.sock fail_timeout=0;
}
server {
listen 80;
server_name my_app_1.com www.my_app_1.com;
root /var/www/app1/current/public;
location ^~ /assets/ {
gzip_static on;
expires max;
add_header Cache-Control public;
}
try_files $uri/index.html $uri @app1_server;
location @app1_server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://app1_server;
}
error_page 500 502 503 504 /500.html;
client_max_body_size 4G;
keepalive_timeout 10;
}
应用 2:
upstream app2_server {
# point to app2 sock
server unix:/tmp/unicorn.app2.sock fail_timeout=0;
}
server {
listen 80;
server_name my_app_2.com www.my_app_2.com;
root /var/www/app2/current/public;
location ^~ /assets/ {
gzip_static on;
expires max;
add_header Cache-Control public;
}
try_files $uri/index.html $uri @app2_server;
location @app2_server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://app2_server;
}
error_page 500 502 503 504 /500.html;
client_max_body_size 4G;
keepalive_timeout 10;
}
关于ruby-on-rails - nginx 和 unicorn 上的多个 Rails 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14159689/
好的,所以我正在尝试使用 unicorn 设置生产服务。 当我尝试通过我编写的脚本启动 unicorn 服务器时,它会启动 2 个主实例。 这只发生在我用给定的“-E 生产”启动它时。 我开始 uni
我使用 'unicorn-worker-killer' gem 并从这里为 ruby GC 做了一些额外的修改 http://blog.newrelic.com/2013/05/28/unicor
我有点卡在工头设置中设置 unicorn worker 的数量 web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb 然后在运行时 fore
我已经在 unicorn 上部署了一个 rails 应用程序,并且正在使用 Capistrano 来管理部署。符号链接(symbolic link) tmp/sockets/unicorn.sock
我已按照 DigitalOcean 指南中的步骤进行操作 here和 here使用 nginx 和 Unicorn 设置 Sinatra 服务器。我在倒数第二步: start the Unicorn
我正在尝试通过 Nginx 和 Unicorn 运行我的 Rails 应用程序,当我尝试运行 service unicorn start 时它告诉我我失败了 master failed to star
有很多研究人员观察着世界上最后剩下的unicorns,即Easter Island。每天,研究人员记录他们发现的 unicorn ,发现日期,每个 unicorn 的婴儿数量以及发现时是否喝醉了。这些
unicorn 接受 listen允许设置 backlog 的配置以毫秒为单位,以防 worker 忙。减小此值允许路由器在忙碌时将请求发送给另一个工作人员。 彪马有类似的东西吗?我找不到这样的东西。
我正在尝试在 heroku 上部署我的 django 应用程序。按照官方文档的步骤操作后,我启动的dyno老是死机。然后我把整个过程都走一遍,我觉得问题可能出在gunicorn部分。按照说明,我将 P
我有这个文件 rails_env = ENV['RAILS_ENV'] || 'development' rails_root = ENV['RAILS_ROOT'] || "/home/luiz/r
在使用 Heroku 时,我发现他们使用环境变量进行服务器本地配置的方法非常棒。现在,在设置自己的应用程序服务器时,我发现自己想知道复制它有多难。 我正在部署一个 sinatra 应用程序,使用 Un
我正在使用 Capistrano 将 Ruby on Rails 应用程序部署到 Linode VPS。我使用 Unicorn 作为应用程序服务器,使用 Nginx 作为代理。我的问题是,由于明显的权
我正在调试我们应用程序中的一些 Posgtres 连接泄漏。几天前,我们突然超过了 100 个连接,这是不应该的 - 因为我们只有 8 个 unicorn worker 和一个 sidekiq 进程(
我正在运行堆栈 nginx+unicorn+rails 3.2 当我运行时 bundle exec unicorn_rails -c config/unicorn.rb -E development
我正在为 Django 项目(Ubuntu 14.04 机器)使用带有 nginx 反向代理的 gunicorn 19.7.1 appserver。 ps aux | grep gunicorn |
我不知道 unicorn 出了什么问题,它不想启动。任何帮助表示赞赏 ubuntu@ip-172-31-15-195:~/www/tf/current$ RAILS_ENV=production bu
我需要你的帮助! 我已经在 Ubuntu 12.04 中部署了我的 Rails 应用程序,使用 Nginx、MySQL、Solr 和 Unicorn。 每个提到的服务都已启动,而不是 unicorn,
我正在使用Rails 3.2 + unicorn + postgres DB,但我有一个问题-unicorn如何处理DB连接? 我的理解: unicorn 主进程 fork X子进程。 每个子进程设置
我有一个 RubyOnRails 项目,并在 Ubuntu 服务器上的 nginx 上使用 Unicorn 部署它。 如果我更改配置文件之一,我需要重新启动 Unicorn,但是当我杀死 Unicor
我正在使用 gunicorn 运行 flask 应用程序(rest api),我几乎每 30 秒就会看到一批 [CRITICAL] WORKER TIMEOUT (pid:14727) . 我的设置如
我是一名优秀的程序员,十分优秀!