Ok, after adjusts:
delivery@deli:~$ cat /var/www/trac/cgi-bin/trac.wsgi
#!/usr/bin/python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2008-2023 Edgewall Software
# Copyright (C) 2008 Noah Kantrowitz <[email protected]>
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at https://trac.edgewall.org/wiki/TracLicense.
#
# This software consists of voluntary contributions made by many
# individuals. For the exact contribution history, see the revision
# history and logs, available at https://trac.edgewall.org/log/.
#
# Author: Noah Kantrowitz <[email protected]>
from trac.web.main import dispatch_request as application
-----------------------------------------------------------
delivery@deli:~$ cat /etc/apache2/sites-available/trac.conf
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/trac
Alias / /var/www/trac/htdocs/common
Alias /trac/chrome/common /var/www/trac/htdocs/common
Alias /trac/chrome/site /var/www/trac/htdocs/site
SetEnv trac.env_path /var/trac
<Directory "/var/www/trac/htdocs">
Options +FollowSymLinks +MultiViews
AllowOverride None
Require all granted
</Directory>
WSGIDaemonProcess trac python-home=/usr/local/venv/trac
display-name=%{GROUP}
WSGIScriptAlias /trac /var/www/trac/cgi-bin/trac.wsgi
process-group=trac application-group=%{GLOBAL}
<Directory "/var/www/trac/cgi-bin">
AllowOverride None
WSGIApplicationGroup %{GLOBAL}
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Require all granted
</Directory>
<Location "/trac/login">
AuthType Basic
AuthName "Trac"
AuthUserFile /etc/apache2/.htpasswd
Require valid-user
</Location>
</VirtualHost>
browser: http://20.195.171.248/trac/chrome/common
response: 404 Not Found T.T
Em sábado, 11 de novembro de 2023 às 00:17:20 UTC-3, Jun Omae escreveu:
> On Sat, Nov 11, 2023 at 11:31 AM MARCOS GONÇALVES TEIXEIRA
> <[email protected]> wrote:
> > trac.wsgi:
> > #!/usr/bin/python3
> > ....
> > ....
> > # Author: Noah Kantrowitz <[email protected]>
> > import os
> > import sys
> > sys.path.insert(0, '/usr/local/venv/trac')
> > os.environ['TRAC_ENV'] = '/usr/local/venv/trac'
> >
> > from trac.web.main import dispatch_request as application
> >
> > #SetEnv PYTHONHOME /usr/local/venv/trac/bin/python3
> > #SetEnv PYTHONPATH /var/trac
> > os.environ['PYTHONHOME'] = '/usr/local/venv/trac/bin/python3'
> > os.environ['PYTHONPATH'] = '/usr/local/venv/trac'
> > #import dispatch_request
> > def application(environ, start_response):
> > environ['trac.env_path'] = '/var/trac'
> > return trac.web.main.dispatch_request(environ, start_response)
> >
>
> No need to insert sys.path and set to os.environ[...].
> The following content is enough:
>
> ====
> #!/usr/bin/python3
> from trac.web.main import dispatch_request as application
> ====
>
> > my trac.conf in /etc/apache2/sites-available:
> > <VirtualHost *:80>
> > ....
> > DocumentRoot /var/trac
> >
> > Alias /chrome/common /var/www/trac/htdocs/common
> > Alias /chrome/site /var/www/trac/htdocs/site
>
> Incorrect. Should be:
>
> Alias /trac/chrome/common /var/www/trac/htdocs/common
> Alias /trac/chrome/site /var/www/trac/htdocs/site
>
> > SetEnv trac.env_path /var/trac
> > <Directory "/var/www/trac/htdocs">
> > Options +Indexes +FollowSymLinks +MultiViews
>
> Indexes should not be used. Remove "+Indexes".
>
> > apache log error:
> > [Sat Nov 11 02:22:13.673726 2023] [mpm_event:notice] [pid 10139:tid
> 140564912088960] AH00492: caught SIGWINCH, shutting down gracefully
> > [Sat Nov 11 02:22:13.812982 2023] [mpm_event:notice] [pid 10281:tid
> 140333620463488] AH00489: Apache/2.4.52 (Ubuntu) mod_wsgi/4.9.0 Python/3.10
> configured -- resuming normal operations
> > [Sat Nov 11 02:22:13.813090 2023] [core:notice] [pid 10281:tid
> 140333620463488] AH00094: Command line: '/usr/sbin/apache2'
> >
> > apache acess error: [11/Nov/2023:02:22:23 +0000] "GET /trac HTTP/1.1"
> 404 493 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML,
> like Gecko) Chrome/117.0.0.0 Safari/537.36"
> >
> > I reinstalled the entire system ubuntu again...
>
> Your problem cannot is be solved by reinstalling Ubuntu. I absolutely
> don't think that is good idea.
> The 404 error is caused by something wrong in your apache configuration.
> Recheck the configuration and post entire of trac.conf.
>
>
> --
> Jun Omae <[email protected]> (大前 潤)
>
--
You received this message because you are subscribed to the Google Groups "Trac
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/trac-users/2773e874-1ad2-4661-a546-11e2099d4fdbn%40googlegroups.com.