Skip to content

Configure Apache2 for PIA BACK

Kevin Beyrand edited this page Jan 26, 2024 · 6 revisions

Find the path to ruby with which ruby

Create a new VirtualHost:

sudo nano /etc/apache2/sites-available/pia-back.conf

Change YOUR_DOMAIN_NAME, YOUR_EMAIL_SUPPORT and PATH_TO_RUBY

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

<VirtualHost *:80>
        ServerName _YOUR_DOMAIN_NAME_

        ServerAdmin _YOUR_EMAIL_SUPPORT_
        DocumentRoot /var/www/pia-back/public
        PassengerRuby _PATH_TO_RUBY_
        ErrorLog ${APACHE_LOG_DIR}/error_pia_back.log
        CustomLog ${APACHE_LOG_DIR}/access_pia_back.log combined

        <Directory /var/www/pia-back/public>
            # This relaxes Apache security settings.
            AllowOverride all
            # MultiViews must be turned off.
            Options -MultiViews
            Order allow,deny
            Allow from all
            # Require all granted
            Options Indexes ExecCGI FollowSymLinks
        </Directory>
</VirtualHost>

Enable this new site:

  • sudo a2ensite pia-back

Reload Apache2:

  • sudo systemctl reload apache2

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