Skip to content

Instantly share code, notes, and snippets.

@vinioliveira
Last active September 26, 2015 05:48
Show Gist options
  • Save vinioliveira/1049270 to your computer and use it in GitHub Desktop.
Save vinioliveira/1049270 to your computer and use it in GitHub Desktop.
Configuring the instalation of nginx+rvm+passenger on Ubuntu 10.10
#Add new user to deploy your application on Ubuntu 10.10
useradd -s /bin/bash -m app-user # add user
passwd app-user # change password
#in /usr/sbin/visudo Add line below just below 'root ALL=(ALL) ALL':
app-user ALL=(ALL) ALL
#change to user early created
su app-user
#then install rvm
sudo apt-get install git curl build-essential vim libcurl4-openssl-dev
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
#run rvm notes to list all dependecies of ruby-1.9.2 install all of them then run
rvm install ruby-1.9.2
#so set ruby-1.9.2 as default system.
rvm ruby-1.9.2 --default
#now create gemset to application
rvm --create use 1.9.2@myapplication
rvm --default use 1.9.2@myapplication
#after that install the passenger and bundler
gem install passenger bundler
#then install nginx the nginx will be installed with passenger module.
rvmsudo passenger-install-nginx-module #run with rvmsudo to allow install into /opt/nginx
#install your application editing /opt/nginx/conf/nginx.conf add into http{ }
server {
listen 80; #the server will be running on this port
server_name www.yourhost.com;
root /home/deployer/your_rails_project/public; # <--- be sure to point to 'public'!
passenger_enabled on;
}
#install now the nginx to run as service with init.d
cd
git clone git@github.com:vinioliveira/rails-nginx-passenger-ubuntu.git
sudo mv rails-nginx-passenger-ubuntu/nginx/nginx /etc/init.d/nginx
sudo chown root:root /etc/init.d/nginx
#after that you'll can use sudo /etc/init.d/nginx start|restart|stop
#finally reboot the machine and that's it your nginx will be running with rvm + passenger + nginx.
sudo shutdown -r now
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment