[Ubuntu] 設置rails的deploy環境

環境:

Ubuntu 14.04
Nginx
MySQL
passenger
rbenv

參考步驟:

1.主要:Deploy Ruby On Rails on Ubuntu 14.04 Trusty Tahr
2.輔助:setup production development


自己補充筆記:

1. 修改 nginx.conf,更改網站根目錄可辨識php文擋

$ sudo nano /etc/nginx/nginx.conf

server {
      listen 80;
      server_name localhost;
      root /var/www;
      index index.html index.htm index.php default.html default.htm defau$


         location ~ \.php$ {
         fastcgi_pass   127.0.0.1:9000;
         fastcgi_index  index.php;
         fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_na$
         include        fastcgi_params;
         }
       }


        ##
        # Virtual Host Configs
        ##

        include /etc/nginx/conf.d/*.conf;
        include /etc/nginx/sites-enabled/*;
}

註:要額外安裝php相關的套件。

2. 設定多網站功能

/etc/nginx/sites-enabled 新增設定檔案,底下是sample範例

server {
        listen 80;
        listen [::]:80;

        server_name rails4.coolsea.net;
        passenger_enabled on;
        rails_env    production;
        root         /home/apps/my_project/apps_name/current/public;

        # redirect server error pages to the static page /50x.html
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
           root   html;
        }
}

修改server_nameroot的位置和資料。

0 回復

發表評論

Want to join the discussion?
Feel free to contribute!

發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *