Defect #11881
closedFCGI mode does not support sub-URI
90%
Description
Hi,
i installed redmine in a subdir /redmine.
My Setup: Redhat5,apache with fcgid
Every links in Redmine are generated correct, e.g. /redmine/projects/bal and so on. But if i go to my projectssettings (/redmine/projects/myproject/settings) some links are not generated correctly.
Tab Members, if i try to change the role -> 404 (The requested URL /memberships/8 was not found on this server. (/redmine/ is missing)
Tab Repositries
edit/del/user-links for an existing repro are not working, same like above:
<a href="/repositories/7/committers" class="icon icon-user">User</a>
<a href="/repositories/7/edit" class="icon icon-edit">Edit</a>
<a href="/repositories/7" class="icon icon-del" data-confirm="Are you sure?" data-method="delete" rel="nofollow">Delete</a>
my Config:
environment.rb:Redmine::Utils::relative_url_root = "/redmine"
environment.rb:ActionController::Base.relative_url_root = "/redmine"
routes.rb (had to add scope and end):
RedmineApp::Application.routes.draw do
scope "/redmine" do
....
end
Related issues
Updated by Jonathan Tee about 12 years ago
Environment:
Redmine version 2.1.0.stable
Ruby version 1.8.7 (x86_64-linux)
Rails version 3.2.8
Environment production
Database adapter MySQL
Updated by Jean-Philippe Lang about 12 years ago
- Status changed from Resolved to New
Updated by Den Iskandarov about 12 years ago
Updated by Etienne Massip about 12 years ago
What's your Apache/.htaccess Redmine specific configuration looks like?
If you don't have any URL rewriting directive, i.e. Rails is handling application routes and assets URLs generation alone, then you could try to:
- remove your changes in both
environment.rb
androutes.rb
- add this single line in
environment.rb
right before the call toRedmineApp::Application.initialize!
:RedmineApp::Application.routes.default_scope = '/redmine'
Updated by Jonathan Tee about 12 years ago
hi,
my .htaccess looks like
#diff htaccess.fcgi.example .htaccess
32a33
RewriteBase /redmine
i changed my config to your suggestion. Now css and js-links are also wrong: /css/.. and /js/... instead of /redmine/css.
everythings else is working, but not the repository-settings. Same error as above.
My apache conf for redmine:
#redmine
Alias /redmine /var/opt/apache/myvirthost/redmine/public/
Updated by Etienne Massip about 12 years ago
Jonathan Tee wrote:
i changed my config to your suggestion. Now css and js-links are also wrong: /css/.. and /js/... instead of /redmine/css.
My bad, you should keep the Redmine::Utils::relative_url_root = '/redmine'
in environment.rb
after the call to initialize!
.
everythings else is working, but not the repository-settings. Same error as above.
It works fine for me and links are correctly generated, could that be a plugin issue?
Updated by Jonathan Tee about 12 years ago
Etienne Massip wrote:
My bad, you should keep the
Redmine::Utils::relative_url_root = '/redmine'
inenvironment.rb
after the call toinitialize!
.
ok, added again. Now css and js-url works fine.
It works fine for me and links are correctly generated, could that be a plugin issue?
i removed all plugins, but same error.
What i don't understand when i look into the view _repositories.html.erb is how the urls are generated:
committers_repository_path(repository)
edit_repository_path(repository)
repository_path(repository)
doesn't work, but
new_project_repository_path(Herve Harster)
works
are these functions? if yes where can i find the definition?
Updated by Etienne Massip about 12 years ago
Jonathan Tee wrote:
are these functions? if yes where can i find the definition?
They are convenience methods automatically created by Rails from the routes definition.
As you set the scope for routes, I don't get why these specific ones wouldn't be treated like the others.
What gives you rake routes RAILS_ENV=production
?
What about running (in production mode) with Webrick (you need to comment out the Redmine::Utils::relative_url_root = '/redmine'
to test it)?
Updated by Abdul Halim Mat Ali about 12 years ago
I have run Redmine in multiple sub-URI and have no issues with it.
Maybe somebody should update http://www.redmine.org/projects/redmine/wiki/HowTo_Install_Redmine_in_a_sub-URI
or any related wiki on sub-URI.
You don't need to set Redmine::Utils::relative_url_root = "/redmine".
Below are the steps if you using apache assuming /var/www is your root directory and you have untar your Redmine
to /opt/redmine.
BTW, I am using Apache with Passenger.
- Create the symbolic link
ln -s /opt/redmine/public /var/www/redmine
- in /etc/httpd/conf.d/redmine.conf
<Location /redmine> RailsEnv production RailsBaseURI /redmine PassengerResolveSymlinksInDocumentRoot on </Location>
Updated by Etienne Massip about 12 years ago
Abdul Halim Mat Ali wrote:
I have run Redmine in multiple sub-URI and have no issues with it.
Abdul, just to make sure, are you using Redmine 2.x?
Updated by Abdul Halim Mat Ali about 12 years ago
Yes. 2.1.0.
BTW, call me Halim.
and I have edited the symbolic link to
ln -s /opt/redmine/public /var/www/redmine
Updated by Jonathan Tee about 12 years ago
Etienne Massip wrote:
What gives you
rake routes RAILS_ENV=production
?
interesting...
all entries have a /redmine-prefix except
membership GET /memberships/:id(.:format) members#show
PUT /memberships/:id(.:format) members#update
DELETE /memberships/:id(.:format) members#destroy
edit_issue_category GET /issue_categories/:id/edit(.:format) issue_categories#edit
issue_category GET /issue_categories/:id(.:format) issue_categories#show
PUT /issue_categories/:id(.:format) issue_categories#update
DELETE /issue_categories/:id(.:format) issue_categories#destroy
committers_repository GET|POST /repositories/:id/committers(.:format) repositories#committers
edit_repository GET /repositories/:id/edit(.:format) repositories#edit
repository PUT /repositories/:id(.:format) repositories#update
DELETE /repositories/:id(.:format) repositories#destroy
relation GET /relations/:id(.:format) issue_relations#show
DELETE /relations/:id(.:format) issue_relations#destroy
if i look into routes.rb, all these entries have ":shallow => true"
Updated by Etienne Massip about 12 years ago
You can try:
RedmineApp::Application.routes.default_scope = { :path => '/redmine', :shallow_path => '/redmine' }
But that shallow_path should already be inherited from path.
Are you sure you didn't change any other configuration setting somewhere?
Updated by Jonathan Tee about 12 years ago
- % Done changed from 0 to 90
thanks, you did it. Now it works :-)
now my environment.rb looks like:
... RedmineApp::Application.routes.default_scope = { :path => '/redmine', :shallow_path => '/redmine' } # Initialize the rails application RedmineApp::Application.initialize! Redmine::Utils::relative_url_root = '/redmine'
I've checked all my configs again but i'm quite sure i did not change other settings. But i know that i didn't changed any core files. Just the files in the config dir.
Updated by Dmitry Vorobiev about 12 years ago
Jonathan Tee wrote:
thanks, you did it. Now it works :-)
now my environment.rb looks like:
[...]I've checked all my configs again but i'm quite sure i did not change other settings. But i know that i didn't changed any core files. Just the files in the config dir.
Jonathan,
I have probably similar problem (#12102), unfortunately advice with RedmineApp::Application.routes.default_scope don't help fix it.
Updated by Etienne Massip about 12 years ago
- Subject changed from Installed Redmine in a sub-URI: Links are generated not correctly in Settings ->Error 404 to FCGI mode does not support sub-URI
- Status changed from New to Confirmed
source:/tags/2.1.2/public/dispatch.fcgi.example should set env['SCRIPT_NAME']
to the value of Redmine::Utils::relative_url_root
.
Updated by Etienne Massip about 12 years ago
- Target version set to Candidate for next minor release
Updated by Etienne Massip about 12 years ago
- Priority changed from High to Normal
Updated by Bill Levering almost 12 years ago
Note: I tried posting this to: http://www.redmine.org/boards/2/topics/30676?r=30881
where it seems it would be most useful, but I always get 'posting denied as spam'
Working Redmine subdir/nginx:
- Redmine 2.2.0 (fresh install)
- no plugins
- ruby 1.9.3p327 (2012-11-10 revision 37606) [x86_64-linux]
- rails (3.2.9)
- passenger (3.0.18)
- nginx version: nginx/1.2.4
as per:
[[http://www.redmine.org/issues/11881#note-14]]
config/environment.rb:
RedmineApp::Application.routes.default_scope = { :path => '/redmine', :shallow_path => '/redmine' } RedmineApp::Application.initialize! Redmine::Utils::relative_url_root = '/redmine'
nginx.conf: (mostly unchanged)
http { passenger_root /usr/local/rvm/gems/ruby-1.9.3-p327/gems/passenger-3.0.18; passenger_ruby /usr/local/rvm/wrappers/ruby-1.9.3-p327/ruby; server { listen 80; server_name localhost; location /redmine { root /usr/local/redmine/public; passenger_enabled on; } } }
THEN, create soft link in the public directory:
cd redmine/public ln -s . redmine
Updated by Den Iskandarov over 11 years ago
no chance to get this fixed in next major or minor release :( ?