Answer the question
In order to leave comments, you need to log in
How to configure mod_wsgi for Apache on Windows XP?
Good day! I'm new to web development from the word "completely", so I apologize if something is wrong) I'm trying to create the first application in django using djangobook. I use: windows XP, python 2.7, django 1.8, apache 2.2 (via denver). Installed mod_wsgi, registered in httpd.conf "LoadModule wsgi_module modules/mod_wsgi.so".
The jangobook goes on to say:
After you install and enable mod_wsgi, edit the Apache web server's httpd.conf file, changing it as follows. If you are using Apache versions lower than 2.4, replace Require all granted` with Allow from all and add Order deny,allow above.WSGIScriptAlias / /path/to/mysite.com/mysite/wsgi.py WSGIPythonPath /path/to/mysite.com <Directory /path/to/mysite.com/mysite> <Files wsgi.py> Require all granted </Files> </Directory>
WSGIScriptAlias / /home/mycode/mysite.com/mysite/wsgi.py
WSGIPythonPath /home/mycode/mysite.com
<Directory /home/mycode/mysite.com/mysite>
<Files wsgi.py>
Order deny,allow
Allow from all
</Files>
</Directory>
You don't have permission to access /Tools/phpmyadmin/index.php on this server.
Denver's hint
Possible causes of the error:
You are trying to run a CGI script from outside the CGI directory (for example, in the documents directory of the www server). Valid paths to CGI directories are as follows:
URL Points to
http://***/cgi-glob/script.cgi /home/cgi-glob/script.cgi
http://***/cgi/script.cgi / home/***/cgi/script.cgi
http://***/cgi-bin/script.cgi /home/***/cgi-bin/script.cgi
If you wish, you can still run scripts and from the www directory. To do this, create an .htaccess file in it (with a dot at the beginning) with the following content:
Options +ExecCGI
You may be trying to open an image or a static HTML file located in a CGI directory. This cannot be done. All images (as well as other files, with the exception of scripts) must be placed in the www directory. See /home/localhost/www for examples.
If you are expecting a directory listing, but this error is returned, it is likely that the directory is not allowed to list (for example, it is a CGI folder). To enable listing, create an .htaccess file in the desired directory with the following content:
Options +Indexes
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Denver's hint
Most likely, the script that runs this page could not execute correctly. The reasons for the error should be described in detail in the Z:/home/localhost/error.log file.
Here are the most common causes of the 500th error:
There are errors in the script. For example, every script should output a Content-Type header before starting to print the page. Read more about this in the article The fight against the 500th error is over.
Valid paths to CGI directories are as follows:
URL Points to
http://***/cgi-glob/script.cgi /home/cgi-glob/script.cgi
http://***/cgi/script.cgi / home/***/cgi/script.cgi
http://***/cgi-bin/script.cgi /home/***/cgi-bin/script.cgi
You haven't installed some libraries that the script needs. For Perl scripts: install the Perl libraries package available at dklab.ru/chicken/web/packages/perl.html.
You specified the wrong first line in the script, which Apache uses to determine the path to the interpreter. The first line should be:
for Perl:
#!/usr/bin/perl -w
or
#!/usr/local/bin/perl -w
for PHP:
#!/usr/bin/php
or
#!/usr/local/ bin/php
This specifies the path, relative to the root, to the files perl.exe and php.exe, respectively (the exe extension and drive letter are omitted for Unix compatibility). Make sure that there is nothing in the script before this line (including comments).
While Denver supports both options, also note that it's more convenient to run PHP scripts from Apache's built-in mod_php rather than the external php.exe program. To use mod_php, simply place the PHP script in the www directory (not the CGI scripts directory).
The current directory contains a .htaccess file with erroneous directives. For example, Apache in Denver does not support the deprecated mod_charset module found on some hosts and treats directives like CharsetDisable as invalid. To fix this, edit the .htaccess file to look something like this:
CharsetRecodeMultipartForms off
# and other mod_charset directives
[Thu Apr 30 21:40:55 2015] [warn] Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)
[Thu Apr 30 21:40:56 2015] [warn] Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)
[Thu Apr 30 21:40:56 2015] [warn] mod_wsgi: Compiled for Python/2.7.9+.
[Thu Apr 30 21:40:56 2015] [warn] mod_wsgi: Runtime using Python/2.7.9.
[Thu Apr 30 21:40:56 2015] [notice] Apache/2.2.22 (Win32) mod_ssl/2.2.22 OpenSSL/1.0.1c mod_wsgi/4.4.11 Python/2.7.9 PHP/5.3.13 configured -- resuming normal operations
[Thu Apr 30 21:40:56 2015] [notice] Server built: Apr 20 2012 18:42:30
[Thu Apr 30 21:40:56 2015] [notice] Parent: Created child process 5880
[Thu Apr 30 21:40:56 2015] [notice] Disabled use of AcceptEx() WinSock2 API
[Thu Apr 30 21:40:56 2015] [warn] Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)
[Thu Apr 30 21:40:57 2015] [warn] Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)
[Thu Apr 30 21: 40:57 2015] [warn] mod_wsgi: Compiled for Python/2.7.9+.
[Thu Apr 30 21:40:57 2015] [warn] mod_wsgi: Runtime using Python/2.7.9.
[Thu Apr 30 21:40:57 2015] [notice] Child 5880: Child process is running
[Thu Apr 30 21:40:57 2015] [notice] Child 5880: Acquired the start mutex.
[Thu Apr 30 21:40:57 2015] [notice] Child 5880: Starting 25 worker threads.
[Thu Apr 30 21:40:57 2015] [notice] Child 5880: Listening on port 443.
[Thu Apr 30 21:40:57 2015] [notice] Child 5880: Listening on port 8648.
[Thu Apr 30 21: 40:57 2015] [notice] Child 5880: Listening on port 443.
[Thu Apr 30 21:40:57 2015] [notice] Child 5880: Listening on port 80.
[Thu Apr 30 21:40:57 2015] [ error] [client 127.0.0.1] Z:/home/mycode/mysite/mysite/wsgi.py is not executable; ensure interpreted scripts have "#!" or "'!" first line, referer: localhost/denwer
[Thu Apr 30 21:40:57 2015] [error] [client 127.0.0.1] (9)Bad file descriptor: don't know how to spawn child process: Z:/home/ mycode/mysite/mysite/wsgi.py, referrer: localhost/denwer
Answer the question
In order to leave comments, you need to log in
Apache and Windows are not needed for Django development python manage runserver
. Apache and Windows are not needed for production.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question