See comments below.
> On 14 Dec 2023, at 10:41 pm, yoshitaka okada <[email protected]>
> wrote:
>
> This is the apache configuration. It was working before I updated python to
> 3.11.
>
> ```
> <VirtualHost *:80>
> # The ServerName directive sets the request scheme, hostname and port
> that
> # the server uses to identify itself. This is used when creating
> # redirection URLs. In the context of virtual hosts, the ServerName
> # specifies what hostname must appear in the request's Host: header to
> # match this virtual host. For the default virtual host (this file)
> this
> # value is not decisive as it is used as a last resort host
> regardless.
> # However, you must set it for any further virtual host explicitly.
> ServerName www.henojiya.net
>
> ServerAdmin webmaster@localhost
> DocumentRoot /var/www/html
>
> # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
> # error, crit, alert, emerg.
> # It is also possible to configure the loglevel for particular
> # modules, e.g.
> #LogLevel info ssl:warn
>
> ErrorLog ${APACHE_LOG_DIR}/error.log
> CustomLog ${APACHE_LOG_DIR}/access.log combined
>
> # For most configuration files from conf-available/, which are
> # enabled or disabled at a global level, it is possible to
> # include a line for only one particular virtual host. For example the
> # following line enables the CGI configuration for this host only
> # after it has been globally disabled with "a2disconf".
> #Include conf-available/serve-cgi-bin.conf
> </VirtualHost>
>
> LoadModule wsgi_module modules/mod_wsgi.so
> LoadModule wsgi_module
> /var/www/html/venv/lib/python3.11/site-packages/mod_wsgi/server/mod_wsgi-py311.cpython-311-x86_64-linux-gnu.so
You should not have:
LoadModule wsgi_module modules/mod_wsgi.so
only the second one:
LoadModule wsgi_module
/var/www/html/venv/lib/python3.11/site-packages/mod_wsgi/server/mod_wsgi-py311.cpython-311-x86_64-linux-gnu.so
The first one is trying to pick up system installed mod_wsgi and would take
precedence, failing if it doesn't exist, and using wrong Python version or
causing other problems if it did. So only use second LoadModule line.
> WSGIScriptAlias / /var/www/html/portfolio/mysite/mysite/wsgi.py
> WSGIPythonPath /var/www/html/portfolio/mysite
The WSGIPythonPath line here only affects embedded mode which you aren't using.
Remove WSGIPythonPath, but also add outside of the VirtualHost:
WSGIRestrictEmbedded On
so that embedded mode is disabled.
> WSGIPythonHome /var/www/html/venv
WSGIPythonHome is technically not needed when disabled embedded mode.
> WSGIDaemonProcess wsgi_app python-home=/var/www/html/venv
> python-path=/var/www/html/portfolio/mysite
> WSGIProcessGroup wsgi_app
> WSGISocketPrefix /var/run/wsgi
> WSGIApplicationGroup %{GLOBAL}
>
> # css, javascript etc
> Alias /static/ /var/www/html/portfolio/mysite/static/
> <Directory /var/www/html/portfolio/mysite/static>
> Require all granted
> </Directory>
> ```
>
> After deleting the log, when I restart and check the status, the following
> error appears.
>
> ```
> [Thu Dec 14 20:29:36.782463 2023] [ssl:warn] [pid 1313720:tid
> 140180280511552] AH01909: ik1-336-28225.vs.sakura.ne.jp:443:0 server
> certificate does NOT include an ID which matches the server name
> [Thu Dec 14 20:29:36.788504 2023] [so:warn] [pid 1313720:tid 140180280511552]
> AH01574: module wsgi_module is already loaded, skipping
> [Thu Dec 14 20:29:36.788520 2023] [so:warn] [pid 1313720:tid 140180280511552]
> AH01574: module wsgi_module is already loaded, skipping
> [Thu Dec 14 20:29:36.800040 2023] [ssl:warn] [pid 1313721:tid
> 140180280511552] AH01909: ik1-336-28225.vs.sakura.ne.jp:443:0 server
> certificate does NOT include an ID which matches the server name
> [Thu Dec 14 20:29:36.800990 2023] [mpm_event:notice] [pid 1313721:tid
> 140180280511552] AH00489: Apache/2.4.41 (Ubuntu) OpenSSL/1.1.1f
> mod_wsgi/4.6.8 Python/3.8 configured -- resuming normal operations
> [Thu Dec 14 20:29:36.801010 2023] [core:notice] [pid 1313721:tid
> 140180280511552] AH00094: Command line: '/usr/sbin/apache2'
> ```
>
> The mod_wsgi operating system package may be installed.
> I'll try resetting the OS once.
>
> thank you
> 2023年12月14日木曜日 19:44:38 UTC+9 Graham Dumpleton:
>>
>>> On 14 Dec 2023, at 9:42 pm, Graham Dumpleton <[email protected] <>>
>>> wrote:
>>>
>>> If using pip install version of mod_wsgi, make sure that you haven't
>>> installed operating system package for mod_wsgi and have configuration
>>> using that still laying around. In other words, you should also have line:
>>
>> Mean to say "In other words, you should NOT also have line"...
>>
>>>
>>> LoadModule wsgi_module modules/mod_wsgi.so <http://mod_wsgi.so/>
>>>
>>> That should be replaced with what "mod_wsgi-express module-config" output.
>>>
>>> I can't comment any further if still got an issue without seeing the Apache
>>> configuration you used and what errors are appearing in any error logs.
>>>
>>>> On 14 Dec 2023, at 9:37 pm, yoshitaka okada <[email protected] <>>
>>>> wrote:
>>>>
>>>> Thank you master :)
>>>> The command now works.
>>>>
>>>> ```
>>>> (venv) rootik1-336-28225:/home/ubuntu# mod_wsgi-express module-config
>>>> LoadModule wsgi_module
>>>> "/var/www/html/venv/lib/python3.11/site-packages/mod_wsgi/server/mod_wsgi-py311.cpython-311-x86_64-linux-gnu.so
>>>> <http://mod_wsgi-py311.cpython-311-x86_64-linux-gnu.so/>"
>>>> ```
>>>>
>>>> I replaced LOAD_MODULE with...
>>>> However, the web server that was previously working does not work at all
>>>> even after restarting.
>>>> ```
>>>> # vi /etc/apache2/sites-enabled/000-default.conf
>>>> ```
>>>> 2023年12月14日木曜日 18:57:59 UTC+9 Graham Dumpleton:
>>>>> The mod_wsgi-express command is available when installing mod_wsgi using
>>>>> pip.
>>>>>
>>>>> See:
>>>>>
>>>>>
>>>>>
>>>>> mod-wsgi
>>>>> pypi.org
>>>>> <https://pypi.org/project/mod-wsgi/>mod-wsgi
>>>>> <https://pypi.org/project/mod-wsgi/>
>>>>> pypi.org <https://pypi.org/project/mod-wsgi/>
>>>>>
>>>>> and watch:
>>>>>
>>>>>
>>>>> Graham Dumpleton - Secrets of a WSGI master. - PyCon 2018
>>>>> youtube.com
>>>>> <https://www.youtube.com/watch?v=CPz0s1CQsTE&t=5s>Graham Dumpleton -
>>>>> Secrets of a WSGI master. - PyCon 2018
>>>>> <https://www.youtube.com/watch?v=CPz0s1CQsTE&t=5s>
>>>>> youtube.com <https://www.youtube.com/watch?v=CPz0s1CQsTE&t=5s>
>>>>> If you want to use configure/make/make install installation method rather
>>>>> than pip (which doesn't provide mod_wsgi-express) and manually configure
>>>>> Apache, then try running:
>>>>>
>>>>> ./configure --with=python=python3
>>>>>
>>>>> By default it still looks for "python" which will only work if using
>>>>> Python 2.X or a virtual environment with Python 3.
>>>>>
>>>>> Graham
>>>>>
>>>>>
>>>>>> On 14 Dec 2023, at 8:42 pm, yoshitaka okada <[email protected] <>>
>>>>>> wrote:
>>>>>>
>>>>>
>>>>>> hello :)
>>>>>>
>>>>>> I am trying to upgrade a Django project on ubuntu.
>>>>>> However, now I am getting an Internal Server Error.
>>>>>>
>>>>>> My environment is as follows
>>>>>> ```
>>>>>> (venv) ubuntu@ik1-336-28225:/usr/src$ cat /etc/issue
>>>>>> Ubuntu 20.04.3 LTS \n \l
>>>>>> ```
>>>>>> ```
>>>>>> apachectl -v
>>>>>> Server version: Apache/2.4.41 (Ubuntu)
>>>>>> Server built: 2023-10-26T13:54:09
>>>>>> ```
>>>>>> ```
>>>>>> (venv) ubuntu@ik1-336-28225:/usr/src$ ls
>>>>>> Python-3.11.7 linux-headers-5.4.0-167-generic
>>>>>> linux-headers-5.4.0-137 linux-headers-5.4.0-169
>>>>>> linux-headers-5.4.0-137-generic linux-headers-5.4.0-169-generic
>>>>>> linux-headers-5.4.0-167 mod_wsgi-5.0.0
>>>>>> ```
>>>>>>
>>>>>> The libraries installed in the django project are as follows:
>>>>>> https://github.com/duri0214/portfolio/blob/master/requirements.txt
>>>>>>
>>>>>> Now, Apparently there is a useful command called mod_wsgi-express.
>>>>>>
>>>>>> The configure command probably worked.
>>>>>> No, but maybe it's not working... ?
>>>>>> ```
>>>>>> (venv) ubuntu@ik1-336-28225:/usr/src/mod_wsgi-5.0.0$ sudo ./configure
>>>>>> [sudo] password for ubuntu:
>>>>>> checking for apxs2... /usr/bin/apxs2
>>>>>> checking for gcc... gcc
>>>>>> checking whether the C compiler works... yes
>>>>>> checking for C compiler default output file name... a.out
>>>>>> checking for suffix of executables...
>>>>>> checking whether we are cross compiling... no
>>>>>> checking for suffix of object files... o
>>>>>> checking whether we are using the GNU C compiler... yes
>>>>>> checking whether gcc accepts -g... yes
>>>>>> checking for gcc option to accept ISO C89... none needed
>>>>>> checking for prctl... yes
>>>>>> checking Apache version... 2.4.41
>>>>>> checking for python... no
>>>>>> ./configure: line 2823: python: command not found
>>>>>> ./configure: line 2827: python: command not found
>>>>>> ./configure: line 2835: python: command not found
>>>>>> ./configure: line 2840: python: command not found
>>>>>> ./configure: line 2854: python: command not found
>>>>>> ./configure: line 2857: python: command not found
>>>>>> ./configure: line 2860: python: command not found
>>>>>> ./configure: line 2863: python: command not found
>>>>>> ./configure: line 2866: python: command not found
>>>>>> ./configure: line 2892: python: command not found
>>>>>> ./configure: line 2895: python: command not found
>>>>>> configure: creating ./config.status
>>>>>> config.status: creating Makefile
>>>>>> ```
>>>>>>
>>>>>> make command doesn't work either.
>>>>>> ```
>>>>>> (venv) ubuntu@ik1-336-28225:/usr/src$ make
>>>>>> make: *** No targets specified and no makefile found. Stop.
>>>>>> ```
>>>>>>
>>>>>> And this command fails, so I'm at a loss as to where I'm going wrong. Is
>>>>>> there anyone who can help?
>>>>>> ```
>>>>>> (venv) ubuntu@ik1-336-28225:/usr/src$ mod_wsgi-express module-config
>>>>>> mod_wsgi-express: command not found
>>>>>> ```
>>>>>>
>>>>>> vi /etc/apache2/sites-enabled/000-default.conf
>>>>>> ```
>>>>>> :
>>>>>> LoadModule wsgi_module modules/mod_wsgi.so <http://mod_wsgi.so/>
>>>>>> :
>>>>>> ```
>>>>>> Load module is probably fine.
>>>>>>
>>>>>> If any information is missing, please let us know :)
>>>>>>
>>>>>
>>>>>> --
>>>>>> 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/46d1e4b2-c376-40d5-b583-c07c1801de3en%40googlegroups.com
>>>>>>
>>>>>> <https://groups.google.com/d/msgid/modwsgi/46d1e4b2-c376-40d5-b583-c07c1801de3en%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/c62b36a8-d867-40b9-a47f-f88c5907dc3an%40googlegroups.com
>>>>
>>>> <https://groups.google.com/d/msgid/modwsgi/c62b36a8-d867-40b9-a47f-f88c5907dc3an%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]
> <mailto:[email protected]>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/modwsgi/ad9da1e9-b26d-47cc-9e18-3c79b5ec34a3n%40googlegroups.com
>
> <https://groups.google.com/d/msgid/modwsgi/ad9da1e9-b26d-47cc-9e18-3c79b5ec34a3n%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/A0CA9DAF-8423-4DED-9452-947204814BAB%40gmail.com.