> On 20 Feb 2022, at 3:30 pm, Dennis Allard <[email protected]> wrote: > > I followed a couple of HOWTO tutorials and it just does not work. > > My server is running Ubuntu 18.04.6 LTS. > > I wish to be able to install mod_wsgi so that I can serve HTTPS requests > using Python. > > My server has LetsEncrypt and I run various web sites on it using php in > some cases. > > I tried to install and configure mod_wsgi per the following HOWTOs: > > https://www.youtube.com/watch?v=q__Nn0RRBvE > > https://www.howtoforge.com/tutorial/how-to-run-python-scripts-with-apache-and-mod_wsgi-on-ubuntu-18-04/
So you didn't use the mod_wsgi docs site at all to work out how to configure Apache for your WSGI application? https://www.modwsgi.org/ > Everything seems to install fine (although the second link about fails to > mention the need to run `a2enmod wsgi` which at one point pregvented me > from restarting apache!). Anyway, I do get to the point that I see this: > > [2022-02-19 20:15:50 root@oceanpark:~/history]# apachectl -M | grep wsgi > wsgi_module (shared) > > And I installed the standard hello world script: > > [2022-02-19 20:15:52 root@oceanpark:~/history]# cat > /etc/apache2/conf-enabled/wsgi.conf > WSGIScriptAlias /wsgi /home/httpd/html/wsgy.py But where was that put in the Apache config file? Is it inside of a VirtualHost? Is the same VirtualHost setup for PHP? Would need to see the whole virtual host configuration to understand whether this would even work in the context you put it. > [2022-02-19 20:17:20 root@oceanpark:~/history]# cat /home/httpd/html/wsgy.py > def application(environ,start_response) You are missing a colon at the end of the preceding line if that is what you actually used. > status = '200 OK' > html = '<html>\n' \ > '<body>\n' \ > 'Eureka, mod_wsgi works!\n' \ > '</body>\n' \ > '</html>\n' > response_header = [('Content-type','text/html')] > start_response(status, response_header) > return [html] > > [2022-02-19 20:17:28 root@oceanpark:~/history]# > > I then restart my web server (via `systemctl restart apache2`). > > I then browse to oceanpark.com/wsgi which returns a Web page saying: > > Internal Server Error > > There is absolutely nothing useful output to my apache server error logs. > Nothing in access.log, nothing in error.log. Nada. What URL did you use to access the WSGI application? Did you check main Apache server host error logs as well as any virtual host error logs? What LogLevel is set for Apache logging. > WTF? > > Can anyone suggest what I might be doing wrong and how on earth can I see an > "Internal Server Error" in my Web browser yet not see anything in either the > access or error logs of apache? Quite possibly depending on how else your Apache is setup, your request could also be getting handled by an existing PHP application. > Most importantly, HOW do I install mod_wsgi so that I can use Python to > process GET and POST requests to my apache server? You are better off using a Python web framework such as Flask. Don't try and construct things yourself using raw WSGI. https://flask.palletsprojects.com/en/2.0.x/ > > I see very little activity on this Google Group and for that matter, very > limited resources concerning how to use Python as an apache module. So > what on earth to people use to use Python as backend for their apache web > servers? > > Cheers, > Dennis Allard > > > > > > > -- > 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] > <mailto:[email protected]>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/modwsgi/cd4a9c3b-da19-49a9-970f-3d94f5525ad3n%40googlegroups.com > > <https://groups.google.com/d/msgid/modwsgi/cd4a9c3b-da19-49a9-970f-3d94f5525ad3n%40googlegroups.com?utm_medium=email&utm_source=footer>. -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/modwsgi/50D2A2AC-1294-4D5B-B610-C3369AB9F1CA%40gmail.com.
