Setup Nginx and Passenger on Ubuntu

Install the nginx and passenger packages.

# Install our PGP key and add HTTPS support for APT
sudo apt-key adv --keyserver hkp:// --recv-keys 561F9B9CAC40B2F7
sudo apt-get install apt-transport-https ca-certificates

# Add APT repository (Use trusty for 14.04 or xenial for 16.04)
sudo sh -c 'echo deb trusty main > /etc/apt/sources.list.d/passenger.list'
sudo apt-get update

# Install Passenger + Nginx
sudo apt-get install nginx-full passenger
Depends on your need, you might want to evaluate using nginx-full or nginx-extras.

Next, open your nginx.conf and make sure passenger.conf is loaded in the http block.

http {
    include /etc/nginx/passenger.conf;

If you could not find passenger.conf in the above directory, you could create one and add these 2 lines into the file. Take note of the username in the path.

passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini;
passenger_ruby /home/username/.rbenv/shims/ruby;

Finally, you could start the nginx server.

sudo service nginx start

AI Summary
Chrome On-device AI 2024-07-20 04:59:16

Share Article