On 22/12/2014, at 9:23 AM, Graham Dumpleton <[email protected]> wrote:
> > On 21/12/2014, at 9:33 AM, marco del corto <[email protected]> wrote: > >> I followed the steps indicated: >> 1) removed the VC11 Apache and installed the VC10 Apache >> 2) Copied the file >> mod_wsgi-windows-4.4.2/Apache24-win64-VC10/modules/mod_wsgi-py34.so from >> Your zip file and put it in the modules directory of the VC10 Apache >> installation >> 3) put a hello.wsgi file in the Apache VC10 installation htdocs directory >> 4) Inside of the Directory block for the htdocs directory, added to the end >> of the line for the existing Options directive: ExecCGI >> 5) Just before the </Directory> added: >> AddHandler wsgi-script .wsgi >> 6) Then just after the </Directory> added: >> WSGIScriptAlias /wsgi c:/Apache24/htdocs/hello.wsgi >> note: without quotes >> 7) Now restart Apache. >> 8) First off, access the URL: >> http://localhost/hello.wsgi -> work fine >> 9) Then access the URL: >> http://localhost/wsgi -> work fine also >> 10) Then added following linees to httpd.conf >> <VirtualHost *:80> >> ServerName www.vm1w8.com >> ServerAlias vm1w8.com >> ServerAdmin [email protected] >> DocumentRoot c:/Apache24/htdocs >> <Directory c:/Apache24/htdocs> >> Require all granted >> </Directory> >> WSGIScriptAlias /myapp_w C:/Apache24/wsgi-scripts/myapp.wsgi >> WSGIScriptAlias /hellowsgi c:/Apache24/wsgi-scripts/hello.wsgi >> <Directory C:/Apache24/wsgi-scripts> >> Require all granted >> </Directory> >> </VirtualHost> >> 11) restarted Apache >> 12) Then access the URL: >> http://localhost/hellowsgi -> got error: >> Forbidden >> You don't have permission to access /hellowsgi on this server > > That isn't necessarily the URL you should be using. > > You for some reason for this test introduced a VirtualHost into the Apache > configuration and have added the configuration inside of that. > > Because you have introduced a VirtualHost and therefore enabled name based > host lookup, the URL would have to be: > > http://www.vm1w8.com/hellowsgi > > to be guaranteed of being mapped to the URL path you set up. This presumes of > course that www.vm1vm8.com maps to this machine. > > Using 'localhost' in the URL will not technically match that VirtualHost > through name based lookup. What would then happen depends a bit on what else > is in the Apache configuration and may also depend on what the browser does > as well. So as to avoid a further round trip in emails. Also specifically indicate whether you have any further VirtualHost definitions in the same Apache configuration which occur before this one you have created. The problem in using localhost is that when it doesn't match the ServerName specified in this VirtualHost, Apache will instead let the request fallback to the first VirtualHost defined in the configuration as it read it. If you have added this VirtualHost at the end of the Apache configuration, but had also fiddled with other parts of the Apache configuration and specifically had uncommented the include for: Include conf/extra/httpd-vhosts.conf then the default VirtualHost's defined in httpd-vhosts.conf would become the first that Apache reads. As a consequence, access 'localhost' would go to those and you would get the exact error you do. When asking you to do these tests I was expecting you would use the original Apache configuration file that came with the ApacheLounge distribution and not start changing it around beyond the changes I as saying. Thus, no introduction of a VirtualHost and not uncommenting any of those Include directives. The Include for httpd-vhosts.conf should never be uncommented unless you are going to properly set it up. This includes commenting out the two dummy VirtualHost definitions which are in it. So even if you did add your VirtualHost to that file and not the main Apache configuration file, if you added it at the end and did not comment out the sample VirtualHost definitions, you will have the problem you are seeing. Graham > > Can you try instead: > > http://www.vm1w8.com/hellowsgi > > Also eliminate the VirtualHost container and define those extra bits outside > of the context of ant VirtualHost. > >> 13) error.log content >> [Sat Dec 20 23:17:49.289532 2014] [mpm_winnt:notice] [pid 2480:tid 424] >> AH00455: Apache/2.4.10 (Win64) mod_wsgi/4.4.2 Python/3.4.2 configured -- >> resuming normal operations >> [Sat Dec 20 23:17:49.305157 2014] [mpm_winnt:notice] [pid 2480:tid 424] >> AH00456: Apache Lounge VC10 Server built: Jul 19 2014 12:25:58 >> [Sat Dec 20 23:17:49.305157 2014] [core:notice] [pid 2480:tid 424] AH00094: >> Command line: 'C:\\Apache24\\bin\\httpd.exe -d C:/Apache24' >> [Sat Dec 20 23:17:49.305157 2014] [mpm_winnt:notice] [pid 2480:tid 424] >> AH00418: Parent: Created child process 4040 >> [Sat Dec 20 23:17:49.664530 2014] [mpm_winnt:notice] [pid 4040:tid 456] >> AH00354: Child: Starting 64 worker threads. >> [Sat Dec 20 23:19:02.789532 2014] [authz_core:error] [pid 4040:tid 976] >> [client ::1:49290] AH01630: client denied by server configuration: >> C:/Apache24/wsgi-scripts >> 14) note: the file c:/Apache24/wsgi-scripts/hello.wsgi has read and execute >> permissions for Apache user > > Can you also explain how you are starting up Apache? I have just been running > httpd.exe by hand and not integrated it into any service startup mechanism > and so it would just run as me. > > Graham > >> Some idea? >> thank you >> >> >> >> Il giorno sabato 20 dicembre 2014 10:26:42 UTC+1, Graham Dumpleton ha >> scritto: >> That config obviously assumed the WSGI hello world script was called >> 'hello.wsgi' in the htdocs directory. >> >> Graham >> >> On 20/12/2014, at 8:22 PM, Graham Dumpleton <[email protected]> wrote: >> >> > >> > On 20/12/2014, at 7:32 PM, marco del corto <[email protected]> wrote: >> > >> >> I'm using: >> >> - Apache 2.4.10 (httpd-2.4.10-win64-VC11.zip from >> >> http://www.apachelounge.com/download/) >> >> - Python 3.4.2 (python-3.4.2.amd64.msi from >> >> https://www.python.org/ftp/python/3.4.2/python-3.4.2.amd64.msi") >> >> and I tried: >> >> - mod_wsgi-3.5.ap24.win-amd64-py3.4 >> >> - mod_wsgi‑4.4.1.ap24.win‑amd64‑py3.4 >> >> - mod_wsgi‑4.4.2.ap24.win‑amd64‑py3.4 >> >> and in all case I got "You don't have permission to access /myapp_w on >> >> this server" (while hello.wsgi in /htdocs works fine). >> >> Do you think I must instead switch to Apache VC10 Win64 >> >> (http://www.apachelounge.com/download/win64/ httpd-2.4.10-win64.zip) with >> >> same Python version? >> > >> > Yes, please switch to: >> > >> > >> > http://www.apachelounge.com/download/win64/binaries/httpd-2.4.10-win64.zip >> > >> > Python 3.4.2 is compiled with the Microsoft VC10 compiler. You cannot >> > necessarily mix binaries compiled with VC10 and VC11. You can have >> > problems, including crashes or other strange behaviour. You should not >> > therefore use the Apache VC11 compiled binary. >> > >> > Also stop using the precompiled mod_wsgi binaries from: >> > >> > http://www.lfd.uci.edu/~gohlke/pythonlibs/ >> > >> > Use the ones in the zip file I referred to in that other email post. >> > >> > Those are binaries I have compiled myself. I know first hand that they >> > appear to work when the correct versions of Python and Apache are used. >> > >> > I am only in a position to debug the binaries I built. I cannot debug >> > those from that other site as I don't know how they were compiled so >> > cannot reproduce anything. >> > >> > So remove the VC11 Apache and install the VC10 Apache. >> > >> > Copy the file: >> > >> > mod_wsgi-windows-4.4.2/Apache24-win64-VC10/modules/mod_wsgi-py34.so >> > >> > from my zip file and put it in the modules directory of the VC10 Apache >> > installation. >> > >> > For the very first tests, put a WSGI hello world in the Apache VC10 >> > installation htdocs directory. >> > >> > def application(environ, start_response): >> > status = '200 OK' >> > output = b'Hello World!' >> > >> > response_headers = [('Content-type', 'text/plain'), >> > ('Content-Length', str(len(output)))] >> > start_response(status, response_headers) >> > >> > return [output] >> > >> > In the Apache configuration file do the following. >> > >> > Inside of the Directory block for the htdocs directory, add to the end of >> > the line for the existing Options directive: >> > >> > ExecCGI >> > >> > Just before the </Directory> add: >> > >> > AddHandler wsgi-script .wsgi >> > >> > Then just after the </Directory> add: >> > >> > WSGIScriptAlias /wsgi "c:/Apache24/htdocs/hello.wsgi" >> > >> > Change the directory for the htdocs directory if necessary. >> > >> > Note that the ExecCGI and AddHandler are not needed for WSGIScriptAlias to >> > work. I am only getting you to add those as well so I can get you to run >> > two tests. >> > >> > Now restart Apache. >> > >> > First off, access the URL: >> > >> > http://localhost/hello.wsgi >> > >> > Then access the URL: >> > >> > http://localhost/wsgi >> > >> > Do both work? >> > >> > Graham >> > >> > >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "modwsgi" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at http://groups.google.com/group/modwsgi. >> For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "modwsgi" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/modwsgi. For more options, visit https://groups.google.com/d/optout.
