-
安裝nginx所需的linux包
sudo apt-get install build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libxml2-dev libxslt-dev autoconf libc6-dev zlib1g-dev libssl-dev build-essential curl git-core libc6-dev g++ gcc
-
添加一個user 并賦予其全部權限
sudo adduser railsadmin
授權,輸入
visudo
在編輯器中找到如下內(nèi)容:
root ALL=(ALL:ALL) ALL
在下面加一行
railsadmin ALL=(ALL:ALL) ALL
-
安裝 passenger/nginx
gem install passenger rvmsudo passenger-install-nginx-module
-
安裝nginx 啟動腳本
https://gist.github.com/hisea/1548664/raw/53f6d7ccb9dfc82a50c95e9f6e2e60dc59e4c2fb/nginxsudo cp nginx /etc/init.d/ sudo chmod +x /etc/init.d/nginx sudo update-rc.d nginx defaults
-
配置nginx
配置文件在 /opt/nginx/config/nginx.confserver { listen 80; server_name higame.com; location / { root /home/railsadmin/ROR/bancheng.com/current/public; index index.html index.htm; passenger_enabled on; } }
如果出現(xiàn) memory out error
https://www.digitalocean.com/community/articles/how-to-add-swap-on-ubuntu-12-04
參考
https://hisea.me/p/rails31-ubuntu-passenger-nginx-quick-deploy