Recently I am reading TRAC 0.12. Now I will record the mod_wsgi and Apache configuration process and some problems encountered so that I can view them later.
1. First install apache2.2
2. Download mod_wsgi.so. Here I use python2.5 and apache2.2. I have not found any corresponding version from the mod_wsgi official website. Most of the official website's versions are python2.6, 2.7, 3.1, and apache2.2.
If you need mod_wsgi 3.0 or a later version for source code compilation, you can search for one from the Internet. If anyone knows the official website corresponding to mod_wsgi.so of python2.5 and apache2.2, please let me know. Thank you.
3. Copy the downloaded mod_wsgi.so to the modules directory of Apache, modify the configuration file httpd. conf, and add the following line:
Loadmodule wsgi_module modules/mod_wsgi.so
4. test whether the configuration is successful. Create a test. wsgi file (the wsgi file is a python module, but the extension is wsgi). The file content is as follows:
Def Application (Environ, start_response ):
Start_response ( " 200 OK " ,[( ' Content-Type ' , " Text/html " )])
Return [ ' <HTML> <body> Hello world! </Body> ' ]
5. Modify the httpd. conf configuration file and add the following line:
Wsgiscriptalias/trac f:/share/TRAC/project/cgi-bin/test. wsgi
6. Restart the Apache server.
7. Enter http: // 127.0.0.1/TRAC in the address bar. If "Hello world" is output, the configuration is successful.
The following are some problems encountered during the configuration process:
1. If docuementroot is not modified by default, http404 is displayed when http: // 127.0.0.1/TRAC is typed in the address bar, and Apache error. log is displayed.Client denied by Server Configuration:
After query, it turns out that this is a problem with the configuration file of apache2.2. Modify the httpd. conf configuration file as follows:
<Directory/>
Options followsymlinks
AllowOverride none
Order deny, allow
AllowFrom all# Change deny to allow
</Directory>
2. When I change DocumentRoot to DocumentRoot "F:/share/TRAC/Project", http: // 127.0.0.1 cannot be accessed, which is summarized as follows:
1> if it is "Deny from all", http: // 127.0.0.1, http: // 127.0.0.1/TRAC cannot be accessed. The error message and solution are displayed.
2> when it is "allow from all", http: // 127.0.0.1/TRAC can be accessed at this time. At that time, http: // 127.0.0.1 cannot be accessed, and the Apache log file is error. the log error message is as follows: Directory Index forbidden by options directive: F:/share/TRAC/project/. It seems to be an options problem. solution, change "Options followsymlinks" to "options all ".
I don't know much about Apache at present. I will explain each option in detail after I have read the Apache documentation in detail.