Trying to install trac cgi

Discussion in 'Server Operation' started by Dytech, Jun 4, 2007.

  1. Dytech

    Dytech New Member

    Hello there,

    I'm trying to install trac project management on my debian ispconfig server.

    i just followed the installation notes using apt-get install trac

    and have set up a trac enviroment.

    Next step was to add the following to apache conf


    Code:
    Alias /trac "/usr/share/trac/htdocs"
        <Location "/cgi-bin/trac.cgi">
            SetEnv TRAC_ENV "/home/trac/cmsv3"
        </Location>
    
        # You need something like this to authenticate users
        <Location "/cgi-bin/trac.cgi/login">
            AuthType Basic
            AuthName "cmsv3"
            AuthUserFile /etc/apache2/dav_svn.passwd
            Require valid-user
        </Location>
    
     The latest documentation can also always be found on the project website:
     http://projects.edgewall.com/trac/
    
    I added this in the ispconfig control panel at the corresponding site. But when i try to view trac i get a 403 Error- Forbidden!

    I copied the trac.cgi to the cgi-bin directory, also chown it to www-data and chmod +x

    also the trac htdocs located in /usr/share/trac/htdocs is chowned to www-data

    Does anyone have any idea how to crack this puzzle?

    Thanks in advance
     
  2. robd

    robd New Member

    Can you
    Code:
    cat /etc/httpd/conf/vhosts/Vhosts_ispconfig.conf
    and snip out the bit for the website in question?
     
  3. Dytech

    Dytech New Member

    Sure! here it is :

    Code:
    ######################################
    # Vhost: www.cmsv3.nl:80
    ######################################
    #
    #
    <VirtualHost 83.96.144.185:80>
    RewriteEngine On
    # Change the URI here to whatever you want your homepage to be
    RewriteRule ^/$ /index.php?module=website [L,QSA]
    # Changes /index.php?module=welcome to /welcome
    RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-d
    RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
    RewriteRule ^/([^/]*)$ /index.php?module=$1 [L,QSA]
    # Changes /index.php?module=users&class=login to /users/login
    RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-d
    RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
    RewriteRule ^/([^/]*)/([^/]*)$ /index.php?module=$1&class=$2 [L,QSA]
    # Changes /index.php?module=users&class=login&event=foo to /users/login/foo.html
    RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-d
    RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
    RewriteRule ^/([^/]*)/([^/]*)/([^/]*).html$ /index.php?module=$1&class=$2&event=$3 [L,QSA]
     Alias /trac '/usr/share/trac/htdocs'
        <Location '/cgi-bin/trac.cgi'>
            SetEnv TRAC_ENV '/home/trac/cmsv3'
        </Location>
        # You need something like this to authenticate users
        <Location '/cgi-bin/trac.cgi/login'>
            AuthType Basic
            AuthName 'cmsv3'
            AuthUserFile /etc/apache2/dav_svn.passwd
            Require valid-user
        </Location>
    ServerName www.cmsv3.nl:80
    ServerAdmin [email protected]
    DocumentRoot /var/www/web16/web
    ServerAlias test.cmsv3.nl cmsv3.nl
    DirectoryIndex index.html index.htm index.php index.php5 index.php4 index.php3 index.shtml index.cgi index.pl index.jsp Default.htm default.htm
    ScriptAlias  /cgi-bin/ /var/www/web16/cgi-bin/
    AddHandler cgi-script .cgi
    AddHandler cgi-script .pl
    ErrorLog /var/www/web16/log/error.log
    AddType application/x-httpd-php .php .php3 .php4 .php5
    php_admin_flag safe_mode Off
    AddType text/html .shtml
    AddOutputFilter INCLUDES .shtml
    AddType application/vnd.wap.wmlscriptc .wmlsc .wsc
    AddType text/vnd.wap.wml .wml
    AddType text/vnd.wap.wmlscript .ws .wmlscript
    AddType image/vnd.wap.wbmp .wbmp
    Alias /error/ "/var/www/web16/web/error/"
    ErrorDocument 400 /error/invalidSyntax.html
    ErrorDocument 401 /error/authorizationRequired.html
    ErrorDocument 403 /error/forbidden.html
    ErrorDocument 404 /error/fileNotFound.html
    ErrorDocument 405 /error/methodNotAllowed.html
    ErrorDocument 500 /error/internalServerError.html
    ErrorDocument 503 /error/overloaded.html
    AliasMatch ^/~([^/]+)(/(.*))? /var/www/web16/user/$1/web/$3
    AliasMatch ^/users/([^/]+)(/(.*))? /var/www/web16/user/$1/web/$3
    </VirtualHost>
    
     
  4. robd

    robd New Member

    Dytech - can you tail -f the http log for that user...
    Code:
    tail -f /home/www/web16/log/error.log
    ...and try and access the page. Post me the output...
     
  5. Dytech

    Dytech New Member

    tail -f

    Sure!

    Here it is :

    Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden: /var/www/web16/cgi-bin/trac.cgi


    over and over again...

    What does this mean?

    I have removed all the rewrite lines in the vhostconf and also the .htaccess files inside the webfolder

    Inside /usr/share/trac/htdocs there are no .htaccess files
     
    Last edited: Jun 5, 2007
  6. falko

    falko Super Moderator ISPConfig Developer

    You can try to add something like this to the vhost configuration:

    Code:
    <Directory /var/www/web16/web>
      Options +FollowSymLinks 
    </Directory>
     
  7. Dytech

    Dytech New Member

    Thanks Falko,

    But that didn't work either.

    I tried :

    <Directory /var/www/web16/web> ( and cgi-bin directory and trac htdocs directory )
    Options +FollowSymLinks
    Options +SymLinksIfOwnerMatch
    </Directory>


    All came up with the same error in the log.

    What can i do?
     
  8. falko

    falko Super Moderator ISPConfig Developer

    Change it to:
    Code:
    <Directory /var/www/web16/web>  ( and cgi-bin directory and trac htdocs directory )
      Options +FollowSymLinks +SymLinksIfOwnerMatch 
    </Directory>
     
  9. Dytech

    Dytech New Member

    Yeah that helped a little, but now i see this in the tail...

    Code:
    [Wed Jun 06 16:06:00 2007] [error] [client 82.176.80.252]  /usr/bin/python: can't open file '/var/www/web16/cgi-bin/trac.cgi'
    
    [Wed Jun 06 16:06:00 2007] [error] [client 82.176.80.252] Premature end of script headers: trac.cgi
     
  10. falko

    falko Super Moderator ISPConfig Developer

    What's the output of
    Code:
    ls -l /var/www/web16/cgi-bin/trac.cgi
    ? Are there maybe Windows linebreaks in that file?
     
  11. Dytech

    Dytech New Member

    That gives :

    Code:
    server1:/var/www# ls -l /var/www/web16/cgi-bin/trac.cgi
    ---x--x--x  1 www-data root 1230 2007-06-04 13:49 /var/www/web16/cgi-bin/trac.cgi
    
    What does ls -l show exactly?

    And guess not that there would be windows line breaks, i downloaded like it is and havent opened it on any windows machine.

    Thank you for all your support!!!
     
  12. falko

    falko Super Moderator ISPConfig Developer

    Please run
    Code:
    chmod 755 /var/www/web16/cgi-bin/trac.cgi
     

Share This Page