Editing
Installing ruby on rails with Nginx passenger
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
* install requisites: '''apt-get install ruby ruby-dev ruby-bundler''' * install the Passenger app: '''apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 561F9B9CAC40B2F7''' '''apt-get install -y apt-transport-https ca-certificates''' '''sh -c 'echo deb https://oss-binaries.phusionpassenger.com/apt/passenger xenial main > /etc/apt/sources.list.d/passenger.list'''' '''apt-get update''' '''apt-get install nginx-extras passenger''' * install ruby dev packages: '''apt-get install libgmp3-dev make gcc g++ libpq-dev ''' * set Nginx to use Passenger: '''vi /etc/nginx/nginx.conf''' * find the following lines, and uncomment them: '''include /etc/nginx/passenger.conf''' * edit the Passenger configuration: '''vi /etc/nginx/passenger.conf''' * change the passenger_ruby line to point to your ruby executable: passenger_ruby /home/deploy/.rbenv/shims/ruby; # If you use rbenv passenger_ruby /home/deploy/.rvm/wrappers/ruby-2.1.2/ruby; # If use use rvm, be sure to change the version number passenger_ruby /usr/bin/ruby; # If you use ruby from source The passenger_ruby is the important line here. Make sure you only set this once and use the line from the example that pertains to the version of Ruby you installed. Once you've changed passenger_ruby to use the right version Ruby, you can run the following command to restart Nginx with the new Passenger configuration: '''service nginx restart''' * In order to get Nginx to respond with the Rails app, we need to modify it's sites-enabled: server { listen 80; server_name devtimesheet.apoyar.eu; passenger_enabled on; rails_env production; passenger_friendly_error_pages on; root /var/www/timesheet; passenger_app_root /var/www/timesheet; access_log /var/log/nginx/timesheet_access.log; error_log /var/log/nginx/timesheet_error.log; # redirect server error pages to the static page /50x.html error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } }
Summary:
Please note that all contributions to Apoyar Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Apoyar Wiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
British English
Views
Read
Edit
View history
More
Search
Navigation
Main page
Apoyar Infrastructure
Active Directory
Recent changes
Random page
Upload file
Tools
What links here
Related changes
Special pages
Page information