国产xxxx99真实实拍_久久不雅视频_高清韩国a级特黄毛片_嗯老师别我我受不了了小说

資訊專欄INFORMATION COLUMN

Nginx with Unicorn to serve your rails app

fasss / 2942人閱讀

This is currently the most popular solution to serve rails apps and is used by many big companies like Github, tweet, 37signals and so on. Also, it is very easy to setup in this way.

Config unicorn Install gem unicorn:

Put gem ‘unicorn’ in Gemfile
then bundle install

Edit unicorn config file

Vim config/unicorn.rb under your rails app root dir.
content:

# The ONLY two things you should change, if you don’t need any specialty.
app_name = "your_app_name"
number_of_app_instances = 2
# Set the working application directory. This should be your rails app root dir, not the public dir
app_root = File.expand_path(File.dirname(__FILE__) + "/..")
working_directory app_root

# File to store unicorn pid
# pid "/path/to/pids/unicorn.pid"
pid "#{app_root}/tmp/pids/unicorn.pid"

# Path to logs
# stderr_path "/path/to/log/unicorn.log"
# stdout_path "/path/to/log/unicorn.log"
stderr_path "#{app_root}/log/unicorn.log"
stdout_path "#{app_root}/log/unicorn.log"

# Unicorn socket
listen "/tmp/unicorn.#{app_name}.sock"

# Number of processes
worker_processes number_of_app_instances

# Time-out
timeout 30
Nginx config Install nginx
sudo apt-get update
sudo apt-get install nginx

Default nginx config file would be located in /etc/nginx

Nginx config file

Add a file in sites_available and put content:

upstream app {
    # Path to Unicorn SOCK file, as defined previously
    server unix:/tmp/unicorn.your_app_name.sock fail_timeout=0;
}

# configure server for your app
server {
    listen 80;
    server_name yourdomain.com www.yourdomain.com;
    root /path/to/your/rails/root/public;

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

    try_files $uri @app;
    location @app {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        proxy_pass http://app;
    }
}
Make a soft link in sites-enabled to the above nginx config file Reload nginx

sudo service nginx restart

Start serving Compile assets: rake assets:precompile

If you only want to server your app in development environment, you don"t need this step.

Start unicorn in production

bundle exec unicorn -c config/unicorn.rb -E production

更多文章請(qǐng)?jiān)L問(wèn)個(gè)人博客
作者:鄒小創(chuàng)
Github
微博
郵件:happystriving@126.com

文章版權(quán)歸作者所有,未經(jīng)允許請(qǐng)勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。

轉(zhuǎn)載請(qǐng)注明本文地址:http://specialneedsforspecialkids.com/yun/39211.html

相關(guān)文章

  • 在阿里云 (aliyun) 服務(wù)器上搭建Ruby On Rails生產(chǎn)環(huán)境

    摘要:最近總是在配置阿里云的服務(wù)器,遇到不少問(wèn)題,現(xiàn)小結(jié)一下,供大家參考阿里云的一鍵安裝全環(huán)境下載一鍵安裝全環(huán)境壓縮包上傳至服務(wù)器,解壓執(zhí)行腳本,具體步驟詳見(jiàn)這里任意選擇一種方法執(zhí)行腳本方法一方法二安裝與指定的版本安裝與指定的版本注意安 最近總是在配置阿里云的服務(wù)器,遇到不少問(wèn)題,現(xiàn)小結(jié)一下,供大家參考~~ 1、阿里云的一鍵安裝web全環(huán)境 下載一鍵安裝web全環(huán)境 sh.zip 壓縮...

    Snailclimb 評(píng)論0 收藏0
  • centos6.2安裝gitlab6.4

    摘要:環(huán)境準(zhǔn)備版本版本版本版本版本因系列的版本是的,已經(jīng)支持,所以不必升級(jí)版本。 環(huán)境準(zhǔn)備 python版本2.6 git版本 1.8.4.1 ruby版本ruby-2.0.0-p353 gitlab-shell版本 v1.8.0 gitlab版本6.4.3 因centos6系列的python版本是2.6的,已經(jīng)支持,所以不必升級(jí)python版本。 在centos5下面需要升級(jí)pyt...

    selfimpr 評(píng)論0 收藏0
  • 使用passenger在Centos7部署nginx+Ruby on Rails

    摘要:是一個(gè)能快速搭建環(huán)境的工具,它能快速的將和部署到你的服務(wù)器中,是部署環(huán)境就如同環(huán)境那樣簡(jiǎn)單快速,讓人愉悅。在上跑一般只有在生產(chǎn)環(huán)境下才會(huì)使用,因而默認(rèn)下就是環(huán)境設(shè)置為生產(chǎn)環(huán)境,而初始化時(shí)默認(rèn)沒(méi)有對(duì)生產(chǎn)環(huán)境進(jìn)行密鑰配置。 passenger passenger是一個(gè)能快速搭建web環(huán)境的工具,它能快速的將nginx和passenger部署到你的服務(wù)器中,是部署ruby環(huán)境就如同php環(huán)...

    UsherChen 評(píng)論0 收藏0
  • Rails が production 環(huán)境で真っ白、SECRET_KEY_BASE 設(shè)定忘れが原因で

    摘要:環(huán)境確認(rèn)確認(rèn)用見(jiàn)出。環(huán)境変數(shù)設(shè)定見(jiàn)。生成値設(shè)定正常動(dòng)作確認(rèn)。環(huán)境変數(shù)渡場(chǎng)合定番。 production 環(huán)境で、なぜか Rails アプリケーションの畫面が真っ白になってしまった。 — 環(huán)境 — Rails 4.1 Unicorn エラーログを確認(rèn) unicorn のエラーログを確認(rèn)しますと… $ tail -f log/unicorn-stderr.log E, [2014-...

    MRZYD 評(píng)論0 收藏0

發(fā)表評(píng)論

0條評(píng)論

最新活動(dòng)
閱讀需要支付1元查看
<