プロジェクト

全般

プロフィール

Vote #72522

未完了

FCGI mode does not support sub-URI

Admin Redmine さんがほぼ4年前に追加. ほぼ4年前に更新.

ステータス:
Confirmed
優先度:
通常
担当者:
-
カテゴリ:
Project settings_43
開始日:
2022/05/09
期日:
進捗率:

90%

予定工数:
category_id:
43
version_id:
33
issue_org_id:
11881
author_id:
63495
assigned_to_id:
0
comments:
21
status_id:
9
tracker_id:
1
plus1:
1
affected_version:
closed_on:
affected_version_id:
43
ステータス-->[Confirmed]

説明

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:

User
Edit
Delete

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


journals

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
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
+1
http://www.redmine.org/issues/11886
--------------------------------------------------------------------------------
a half duplicate #11274
--------------------------------------------------------------------------------
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@ and @routes.rb@
* add this single line in @environment.rb@ right +before+ the call to @RedmineApp::Application.initialize!@:
<pre><code class="ruby">
RedmineApp::Application.routes.default_scope = '/redmine'
</code></pre>
--------------------------------------------------------------------------------
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/

--------------------------------------------------------------------------------
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?

--------------------------------------------------------------------------------
Etienne Massip wrote:
> My bad, you should keep the @Redmine::Utils::relative_url_root = '/redmine'@ in @environment.rb@ after the call to @initialize!@.

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(@project)
works

are these functions? if yes where can i find the definition?

--------------------------------------------------------------------------------
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)?

--------------------------------------------------------------------------------
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
<pre>
ln -s /opt/redmine/public /var/www/redmine
</pre>

* in /etc/httpd/conf.d/redmine.conf
<pre>
<Location /redmine>
RailsEnv production
RailsBaseURI /redmine
PassengerResolveSymlinksInDocumentRoot on
</Location>
</pre>
--------------------------------------------------------------------------------
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?

--------------------------------------------------------------------------------
Yes. 2.1.0.

BTW, call me Halim.

and I have edited the symbolic link to
<pre>
ln -s /opt/redmine/public /var/www/redmine
</pre>
--------------------------------------------------------------------------------
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"
--------------------------------------------------------------------------------
You can try:
<pre><code class="ruby">
RedmineApp::Application.routes.default_scope = { :path => '/redmine', :shallow_path => '/redmine' }
</code></pre>

But that shallow_path should already be inherited from path.

Are you sure you didn't change any other configuration setting somewhere?

--------------------------------------------------------------------------------
thanks, you did it. Now it works :-)

now my environment.rb looks like:
<pre>
...
RedmineApp::Application.routes.default_scope = { :path => '/redmine', :shallow_path => '/redmine' }

# Initialize the rails application
RedmineApp::Application.initialize!
Redmine::Utils::relative_url_root = '/redmine'
</pre>

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 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.
--------------------------------------------------------------------------------
source:/tags/2.1.2/public/dispatch.fcgi.example should set @env['SCRIPT_NAME']@ to the value of @Redmine::Utils::relative_url_root@.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
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:
<pre>
RedmineApp::Application.routes.default_scope = { :path => '/redmine', :shallow_path => '/redmine' }
RedmineApp::Application.initialize!
Redmine::Utils::relative_url_root = '/redmine'
</pre>

nginx.conf: (mostly unchanged)
<pre>
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;
}
}
}

</pre>
THEN, create soft link in the public directory:
<pre>
cd redmine/public
ln -s . redmine
</pre>
--------------------------------------------------------------------------------
no chance to get this fixed in next major or minor release :( ?
--------------------------------------------------------------------------------


related_issues

relates,New,11274,Repository edit link is incorrect when running in a sub-URI
relates,New,11886,Broken link while edit/delete "Issue Category" under project in Redmine 2.1.0
relates,New,12102,Installed Redmine in a sub-URI: Links are generated not correctly
relates,Closed,12420,URLs in notification emails do not include the sub-URI

Admin Redmine さんがほぼ4年前に更新

  • カテゴリProject settings_43 にセット
  • 対象バージョンCandidate for next minor release_33 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0