Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails + Passenger + Apache + Alias

I have a problem with Rails + Passenger + Apache + Alias. I tried to run a rails app over an Alias and I declared this virtualhost

<VirtualHost *:80>
    Alias /smart_data /home/pablo/Proyectos/Net-Works/SmartData/smart_data/public
    <Location /smart_data>
        PassengerBaseURI /smart_data
        PassengerAppRoot /home/pablo/Proyectos/Net-Works/SmartData/smart_data
    </Location>
    <Directory /home/pablo/Proyectos/Net-Works/SmartData/smart_data/public>
        Allow from all
        Options -MultiViews
        Require all granted
    </Directory>
</VirtualHost>

It works ok, but my app read a file from the folder /public/data/ and apache try read this file from /var/www/html/data.

Could someone help me?.

like image 387
Pablo Luis Reyes Fernández Avatar asked Feb 23 '26 14:02

Pablo Luis Reyes Fernández


1 Answers

You need to define a DocumentRoot within the VirtualHost tags.

<VirtualHost *:80>
  # Add this line:
  DocumentRoot /home/pablo/Proyectos/Net-Works/SmartData/smart_data/public
</VirtualHost>

Since no DocumentRoot is defined there, it's going with the default one (defined somewhere in the same config file, but not nested in any VirtualHost tag)

like image 127
Isaac Betesh Avatar answered Feb 25 '26 04:02

Isaac Betesh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!