Skip to content

Configure Nginx for PIA BACK

Bruno Perles edited this page Feb 20, 2024 · 12 revisions

For NGINX server

Find the path to ruby with which ruby

Create a config file:

sudo nano /etc/nginx/sites-available/pia-back

Beware with the port here, <VirtualHost *:80> it might be a different port for you, if for example your Front already uses this one.

server {
    listen 80;
    server_name _YOUR_DOMAIN_NAME_;

    # Tell Nginx and Passenger where your app's 'public' directory is
    root /var/www/pia-back/public;

    # Turn on Passenger
    passenger_enabled on;
    passenger_ruby _PATH_TO_RUBY_;
}

Enable this new site:

sudo ln -s /etc/nginx/sites-available/pia-back /etc/nginx/sites-enabled/pia-back

Reload Nginx:

sudo systemctl reload nginx

If you have made some update on pia-back, please restart the application following the Passenger documentation https://www.phusionpassenger.com/library/admin/apache/restart_app.html

Error with libcrypto and phusion passenger

If you have this error with libcrypo.so.1.1:

PassengerAgent: /lib/x86_64-linux-gnu/libcrypto.so.1.1: version `OPENSSL_1_1_1' not found (required by PassengerAgent)

Install libssl 1.1 manually:

wget https://debian.mirror.ac.za/debian/pool/main/o/openssl/libssl1.1_1.1.1w-0%2Bdeb11u1_amd64.deb
sudo dpkg -i libssl1.1_1.1.1w-0+deb11u1_amd64.deb