On 2022-11-26 12:02, Mark Sapiro wrote:
On 11/25/22 23:00, Jan Eden via Mailman-users wrote:
proxy_pass http://127.0.0.1:8000; → proxy_pass http://unix:/opt/mailman/mm/var/mailman.sock;
and received an error message (as expected):
Because that won't work. You can't http to a unix socket in that way.
Use
uwsgi_pass unix:/opt/mailman/mm/var/mailman.sock;
There are obviously a couple of places where the http-socket on port 8000 is referenced (e.g. mailman_web/settings/mailman.py, /opt/mailman/mm/hyperkitty.cfg). Is there an overview of the required changes when using a different (file) socket?
If you configure uwsgi with only a unix
socket
and nohttp-socket
, nothing will be listening on port 8000. Thus, you need to configure those references to public facing URLs and let ngnix determine where to go.e.g., for mailman-hyperkitty.cfg
[general] base_url: http://example.com/archives/
and in settings.py
POSTORIUS_TEMPLATE_BASE_URL = 'https://example.com'
to override the
localhost:8000
reference in mailman_web/settings/mailman.py.
Thank you! This all makes sense, but uwsgi logged the following error after applying the changes above:
Traceback (most recent call last): File "/opt/mailman/venv/lib/python3.10/site-packages/django/core/handlers/wsgi.py", line 130, in __call__ request = self.request_class(environ) File "/opt/mailman/venv/lib/python3.10/site-packages/django/core/handlers/wsgi.py", line 78, in __init__ self.method = environ["REQUEST_METHOD"].upper() KeyError: 'REQUEST_METHOD' Traceback (most recent call last): File "/opt/mailman/venv/lib/python3.10/site-packages/django/core/handlers/wsgi.py", line 130, in __call__ request = self.request_class(environ) File "/opt/mailman/venv/lib/python3.10/site-packages/django/core/handlers/wsgi.py", line 78, in __init__ self.method = environ["REQUEST_METHOD"].upper() KeyError: 'REQUEST_METHOD'
So I checked my local Django configuration and found an include directive in mysite_nginx.conf (include /etc/nginx/uwsgi_params;) where the referenced file uwsgi_params contained the following:
uwsgi_param QUERY_STRING $query_string; uwsgi_param REQUEST_METHOD $request_method; uwsgi_param CONTENT_TYPE $content_type; uwsgi_param CONTENT_LENGTH $content_length;
uwsgi_param REQUEST_URI $request_uri; uwsgi_param PATH_INFO $document_uri; uwsgi_param DOCUMENT_ROOT $document_root; uwsgi_param SERVER_PROTOCOL $server_protocol; uwsgi_param REQUEST_SCHEME $scheme; uwsgi_param HTTPS $https if_not_empty;
uwsgi_param REMOTE_ADDR $remote_addr; uwsgi_param REMOTE_PORT $remote_port; uwsgi_param SERVER_PORT $server_port; uwsgi_param SERVER_NAME $server_name;
Replicating this setup on the server solved the KeyError problem, everything works now! I just wonder why these uwsgi parameters need to be passed explicitly when using a file socket, but not with a http socket.
Another (unrelated) question: Why is mailman_hyperkitty.cfg placed in /opt/mailman/mm and not in /etc/mailman3 with the other configuration files when using the virtualenv installation instructions (https://docs.mailman3.org/en/latest/install/virtualenv.html#virtualenv-insta...
Thanks again for all your help (and patience)!
- Jan