1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Tutorial: How to install Nginx with Passenger on Fedora.

How to install Nginx with Passenger on Fedora.

  1. sbagmeijer
    In this guide I will show how you can install Passenger compiled with Nginx on Fedora.
    Please be aware I am not a Passenger expert and this guide is based on what I normally do.

    There are two version of Passenger a open-source version that I will use for this guide and a paid Enterprise version, if you are going to use Passenger in your company I would advise to have a look at their website for the Enterprise version:

    For this guide I used the following:
    Server (1x cpu, 2gb ram)
    Fedora 22
    Passenger + Nginx
    This guide should also work on RHEL, CentOS and OracleLinux but you might need to change some directory locations or use slightly different commands.

    Step 1: Add the Ulyaoth repository
    Have a look on my forum for the latest rpm and instructions:

    Step 2: install the required packages
    $ sudo dnf install -y ulyaoth-nginx-passenger5 openssl ruby rubygem-rails
    If you have selinux you should also install:
    $ sudo dnf install -y ulyaoth-nginx-passenger5-selinux
    Step 3: Create the following directories
    $ sudo mkdir -p /usr/share/nginx/ulyaoth/public
    $ sudo mkdir -p /var/log/nginx/passenger.ulyaoth.net
    Step 4: Fix your Firewall to allow port 80.
    $ firewall-cmd --permanent --zone=FedoraServer --add-service=http
    Step 5: Restart firewalld.
    $ sudo systemctl restart firewalld.service
    Step 6: Put nginx-passenger on autostart when the server is rebooted.
    $ sudo systemctl enable nginx.service
    Step 7: Download the nginx vhost and symbolic link it.
    $ sudo wget https://raw.githubusercontent.com/sbagmeijer/ulyaoth/master/guides/passenger/nginx/passenger.ulyaoth.net.conf -O /etc/nginx/sites-available/passenger.ulyaoth.net.conf
    $ sudo ln -s /etc/nginx/sites-available/passenger.ulyaoth.net.conf /etc/nginx/sites-enabled/passenger.ulyaoth.net.conf
    Step 8: Open the vhost and fix the server name.
    $ sudo vi /etc/nginx/sites-available/passenger.ulyaoth.net.conf
    Now change the line with "passenger.ulyaoth.net" to the domain name you will use.

    Step 9: Open passenger.conf and add the following:.
    $ sudo vi /etc/nginx/conf.d/passenger.conf
    add the following:
    passenger_pre_start http://passenger.ulyaoth.net/;
    passenger_min_instances 2;
    passenger_max_pool_size 4;
    Ofcourse change "passenger.ulyaoth.net" to the website you use in the nginx.con "server_name" block at step 10.

    you should this config now:
    passenger_log_level 2;
    passenger_log_file /var/log/passenger/passenger.log;
    passenger_pre_start http://passenger.ulyaoth.net/;
    passenger_min_instances 2;
    passenger_max_pool_size 4;
    passenger_instance_registry_dir /var/cache/nginx/passenger_temp/;
    passenger_root /etc/nginx/modules/passenger;
    passenger_ruby /usr/bin/ruby;
    Change everything accordingly to what you will use! For the "passenger_pre_start" make sure you use the domain you used in the vhost above.

    Step 10: Download a test file to see if passenger works.
    $ sudo wget https://raw.githubusercontent.com/sbagmeijer/ulyaoth/master/guides/passenger/app/config.ru -O /usr/share/nginx/ulyaoth/config.ru
    Step 11: Start Nginx
    $ sudo systemctl start nginx.service
    If you now browse to your website you should see it running:

    Some notes:
    Please be aware for my example I used rails if you not need this then do not install it ofcourse, also the example above is a quick way never run a website in production as root so make sure you run passenger as a different user.

    For more information on passenger option please have a read trough their extensive information page on:
    https://www.phusionpassenger.com/documentation/Users guide Nginx.html