Created
September 10, 2012 21:55
-
-
Save FernandoEscher/3694209 to your computer and use it in GitHub Desktop.
Server configuration for Rails: Configuring the web server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Enter the root account | |
sudo su | |
# Set your applications gemset | |
rvm gemset use MyAppName | |
# Install passenger | |
gem install passenger | |
# Install passenger module along with nginx | |
passenger-install-nginx-module | |
# If curl ssl headers are needed | |
apt-get install libcurl4-openssl-dev | |
# Exit the root account | |
exit | |
# Remove your application's clone | |
rm -rf ~/MyAppName/ | |
# Create the applications folder | |
sudo mkdir -p /opt/deployed/MyAppName | |
# Change the ownership of the directory (assuming MyAppName as your user) | |
sudo chown MyAppName /opt/deployed/MyAppName | |
sudo chgrp MyAppName /opt/deployed/MyAppName | |
# Set the permissions for your directories | |
sudo chmod 777 /opt/deployed | |
sudo chmod 770 /opt/deployed/MyAppName | |
# Configure nginx to recognize your application, passenger and rvm gemset | |
vim /opt/nginx/conf/nginx.conf | |
# Set this directive at the end of the html one | |
http { | |
... | |
passenger_root /usr/local/rvm/gems/ruby-1.9.3-p125@MyAppName/gems/passenger-3.0.13; | |
passenger_ruby /usr/local/rvm/wrappers/ruby-1.9.3-p125@MyAppName/ruby; | |
... | |
server { | |
listen 80; | |
server_name mydomain.com www.mydomain.com; | |
root /opt/deployed/MyAppName/current/public; | |
passenger_enabled on; | |
client_max_body_size 50M; # If you want to allow file uploads | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment