Help! Sub-URI for Passenger with Apache 2 does not work!
I am trying to setup Redmine 1.1.3 application on my Ubuntu 8.04 with Apache2 and Passenger 3.0.7. I have verified that my installation of Redmine is working properly by running Webrick as web server. As I have read that it is not the recommended webserver for Production, I have decided to host it using Apache 2.
I am planning to configure the Apache webserver to support sub-URI, with reference to the guide: http://www.modrails.org/documentation/Users%20guide%20Apache.html#deploying_rails_to_sub_uri. However, I am having some problem with the configuration of the Apache2's config file called "default" in the "sites-available" folder.
Below is my configuration in the "default" file:
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName www.mydomain.com
**DocumentRoot /var/www**
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
<Directory /var/www/redmine>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all
</Directory>
RailsBaseURI /redmine
RailsEnv production
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
ServerSignature On
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
This configuration has returned with a "no such file to load -- /var/www/config/environment" error, after accessing Redmine via "http"//www.mydomain.com/redmine".
This error is only overcome if I change the "Document Root" to "/usr/local/redmine-1.1.3/public", which is where the Redmine application codes is located.
Note: 1. I have already created the symlink in "/var/www/redmine" as described in the guide. 2. I have also "chown" the entire "redmine-1.1.3" folders and files (recursively) to "www-data".
I will appreciate if anyone can help me to configure my setup correctly as I really hope to make use of the sub-URI approach, so 开发者_StackOverflowthat I can maintain the use of a common port "80" for multiple applications.
Thank you in advance.
Cheers,
Kevin
I have a similar setup working on Mac. Mine is setup without Virtual Hosts since I wanted to keep some php apps running and Passenger was interfering with those if enabled for the entire site.
I have two setup files included from my apache httpd.conf file:
passenger.conf
LoadModule passenger_module /Library/Ruby/Gems/1.8/gems/passenger-3.0.7/ext/apache2/mod_passenger.so PassengerRoot /Library/Ruby/Gems/1.8/gems/passenger-3.0.7 PassengerRuby /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby PassengerEnabled Off
redmine.conf
<Location "/redmine"> Options Indexes ExecCGI FollowSymLinks -MultiViews Order allow,deny Allow from all AllowOverride all PassengerEnabled On RailsBaseURI /redmine RailsEnv production </Location>
My system is Mac so the paths might be different, but I have it set up with a symlink in my docroot pointing to my redmine's public directory.
Perhaps the "RailsBaseURI" will be the key to getting it working for you.
精彩评论