Edgewall Software
Modify

Ticket #2395 (closed defect: worksforme)

Opened 6 years ago

Last modified 6 years ago

FastCGI : problem with project URL

Reported by: jouvin@… Owned by: jonas
Priority: normal Milestone:
Component: general Version: 0.9
Severity: normal Keywords:
Cc: jouvin@…
Release Notes:
API Changes:

Description

I have a strange behaviour with FastCGI.

I have set an URL to match one specific project with FastCGI with the following Apache config :

        Alias /lcg/chrome/site "/tmp_mnt/www/Web/servers/trac/site-config"
        Alias /lcg/chrome/common "/tmp_mnt/www/Web/servers/trac/new/share/trac/h
tdocs"
        ScriptAlias /lcg "/htdocs/tractest/bin/trac.fcgi"
        <Location "/lcg">
                SetEnv TRAC_ENV /projects/trac-new/LCGTier2
                SetEnv  PYTHONPATH /www/Web/servers/trac/new/lib/python2.4/site-
packages
                SetEnv PYTHON_EGG_CACHE /tmp/tractest/python-eggs-cache
        </Location>

If I enter url http://trac/lcg, I get the project list generated by trac.fcgi (I have specified TRAC_ENV and not TRAC_ENV_PARENT_DIR). If I click on one project (e.g. Test), I get url http://trac/lcg/Test but it works.

I also specified an url to match a multiproject parent path with the following config :

        Alias /tracf/chrome/common "/tmp_mnt/www/Web/servers/trac/new/share/trac
/htdocs"
        Alias /tracf/chrome/site "/tmp_mnt/www/Web/servers/trac/site-config"
        ScriptAlias /tracf "/htdocs/tractest/bin/trac.fcgi"
        <Location "/tracf">
                SetEnv TRAC_ENV_PARENT_DIR /projects/trac-new
                SetEnv  PYTHONPATH /www/Web/servers/trac/new/lib/python2.4/site/
packages
               SetEnv PYTHON_EGG_CACHE /tmp/tractest/python-eggs-cache
        </Location>

This one works properly. http://trac/tracf gives the project list and Test project is accessed under http://trac/tracf/Test.

Last I tried to set up project directly under / as we have done with CGI and mod_python. I used the following configuration :

        RewriteCond /projects/trac-new/$1              -d
        RewriteRule ^/([[:alnum:]]+)(/?.*)     %{DOCUMENT_ROOT}/bin/trac.fcgi$2
 [S=1,E=PYTHONPATH:/www/Web/servers/trac/new/lib/python2.4/site-packages,E=TRAC_
ENV_PARENT_DIR=/projects/trac-new,E=PYTHON_EGG_CACHE:/tmp/tractest/python-eggs-c
ache]

I get the same (mis)behaviour as with the first config (/lcg). If I enter http://trac/Test I get the project list and Test project under http://trac/Test/Test.

May be I did something wrong but I reread my config several times carefully and didn't find...

Michel

Attachments

Change History

comment:1 Changed 6 years ago by anonymous

  • Cc jouvin@… added
  • Milestone set to 0.9.1

I first tested with 0.9. Before filling this ticket, I upgraded to 0.9.1dev, source:/branches/0.9-stable#2544

comment:2 Changed 6 years ago by cmlenz

  • Milestone changed from 0.9.1 to 0.9.2

comment:3 Changed 6 years ago by mgood

  • Milestone 0.9.3 deleted
  • Resolution set to worksforme
  • Status changed from new to closed

Putting Trac at the root URL doesn't require any rewriting rules, instead use:

ScriptAlias / "/htdocs/tractest/bin/trac.fcgi"

I think that you also need to use the FastCgi directives to pass env vars instead of using SetEnv. See the examples in TracFastCgi, such as:

FastCgiConfig -initial-env TRAC_ENV=/path/to/env/trac

Also note that you don't need to Alias the /chrome paths with FastCGI, and it's probably better not to since your settings won't actually do anything with the multi-project setup.

comment:4 Changed 6 years ago by jouvin@…

  • Resolution worksforme deleted
  • Status changed from closed to reopened

I made some new tests with FastCGI in multiproject config with projects rooted uner / URL. With some cleaning in my Apache virtual host configuration, I now have only the the following directive :

        ScriptAlias "/" "/htdocs/tractest/bin/trac.fcgi"

If I give the virtual host (http://tractest.lal.in2p3.fr) as URL, I get the project list. If I click on one project, I get a 'page not found' error. Looking at Apache logs, I find the following error (LCGTier2 is my project name) :

[Mon Jan 16 16:57:48 2006] [error] [client 134.158.72.114] script not found or unable to stat: /htdocs/tractest/bin/trac.fcgiLCGTier2, referer: https://tractest

If I use '/tracf' (or something else) as my project root URL, it works as expected.
If I use single project under root, it also basically works (with some pbs to find css I didn't try to solve).

This is not clear for me where the pb lies.

The FastCGI configuration directive is :

     FastCgiServer /htdocs/tractest/bin/trac.fcgi -initial-env TRAC_ENV_PARENT_D
IR=/projects/trac-new -initial-env PYTHON_PATH=/www/Web/server/trac/new/lib/pyth
on2.4/site-packages -initial-env PYTHON_EGG_CACHE=/tmp/tractest/python-eggs-cach
e

comment:5 Changed 6 years ago by anonymous

  • Milestone set to 0.9.4

comment:6 Changed 6 years ago by mgood

  • Milestone 0.9.4 deleted
  • Resolution set to worksforme
  • Status changed from reopened to closed

Use

ScriptAlias "/" "/htdocs/tractest/bin/trac.fcgi/"

Note the trailing "/" at the end to match the fact that the aliased path also ended with a "/".

This is really an installation support issue, so please use the MailingList or IrcChannel if you need further help.

comment:7 Changed 6 years ago by mgood

Oops, I guess I left the trailing "/" out in my previous example. It's one of those Apache config quirks that's easy to forget.

comment:8 Changed 6 years ago by jouvin@…

Thank you very much. It works now. In fact I was remembering this trailing / issue but was not able to get the reference. And I was confused by your first example and the fact that it works without the trailing / if you have a /xxx URL.

Probably something to emphazise in TracCgi and/or TracFastCgi wiki pages. I reread them again but found no mention of that.

comment:9 Changed 6 years ago by elmi

  • Cc abbdi_elmi@… added; jouvin@… removed
  • Component changed from general to search system
  • Keywords studete added
  • Milestone set to 0.7
  • Priority changed from normal to lowest
  • Severity changed from normal to trivial
  • Type changed from defect to task
  • Version changed from 0.9 to 0.8.2

[]

'

comment:10 Changed 6 years ago by cmlenz

  • Cc jouvin@… added; abbdi_elmi@… removed
  • Component changed from search system to general
  • Keywords studete removed
  • Milestone 0.7 deleted
  • Priority changed from lowest to normal
  • Severity changed from trivial to normal
  • Type changed from task to defect
  • Version changed from 0.8.2 to 0.9
View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
to The owner will be changed from jonas. Next status will be 'closed'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.