Last active
December 26, 2015 20:39
-
-
Save bogdanRada/7210566 to your computer and use it in GitHub Desktop.
Passenger Apache setup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
After successful installation of the Apache 2 module, follow the next set of step to configure Apache. | |
Create the following two files in /etc/apache2/mods-available | |
sudo touch /etc/apache2/mods-available/passenger.load | |
paste following code in passenger.load file | |
LoadModule passenger_module /usr/lib/ruby/gems/1.9.2(your version)/gems | |
/passenger-3.0.2/ext/apache2/mod_passenger.so | |
sudo touch /etc/apache2/mods-available/passenger.conf | |
paste following code in passenger.conf file | |
PassengerRoot /usr/lib/ruby/gems/1.9.2/gems/passenger-3.0.2 | |
PassengerRuby /usr/bin/ruby1.9.2 | |
2. Enable the modules by creating the following symbolic links in /etc/apache2/mods-enabled | |
$ ln -s /etc/apache2/mods-available/passenger.load /etc/apache2/mods-enabled/passenger.load | |
$ ln -s /etc/apache2/mods-available/passenger.conf /etc/apache2/mods-enabled/passenger.conf | |
3.Now create a virtual host by adding the following to 000-default file in /etc/apache2/sites-enabled. | |
<Directory /var/www/your_app> | |
RailsBaseURI /your_app | |
RailsEnv development | |
AllowOverride all | |
Options -MultiViews | |
allow from all | |
</Directory> | |
Now create soft link of your application, make sure you application must reside in /opt , To do you may create a separate folder for your application. | |
i. $ sudo mkdir -p /opt/rails_apps | |
ii. $ sudo cp -R /path/to/your_app/ /opt/rails_apps/ | |
iii. $ sudo ln -s /opt/rails_apps/your_app/public/ /var/www/your_app | |
Then restart apache with the following command. | |
/etc/init.d/apache2 restart | |
You will get an error message when you restart Apache if you've included, verbatim, the following: | |
AllowOverride all # <-- relax Apache security settings | |
Options -MultiViews # <-- MultiViews must be turned off | |
The error it spits out is: | |
user@my_server:~/your_site# sudo /etc/init.d/apache restart | |
Syntax error on line 11 of /etc/apache2/sites-enabled/your_site: | |
Illegal override option # | |
Action 'configtest' failed. | |
The Apache error log may have more information. | |
...fail! | |
root@my_server:~/your_site# | |
The fix? Remove the comment lines that follow so it looks like this: | |
AllowOverride all | |
Options -MultiViews | |
Hope this helps! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment