So, I have successfully installed mailman3 and it's working great. However, the way it works now, if someone goes to the domain website, he or she will get the mailman page. I'd prefer that it work something like: My www.example.com goes to a home page lists.example.com goes to the mailman3 page mail.example.com goes to a roundcube page
I'm using nginx, and this is the first time I've set up an nginx server (I have traditionally done apache), and I'm still figuring out the syntax.
My sites-available file is below, for the domain emergenus.com.
The behavior I'm getting is that if I go to mail.emergenus.com, it still redirects to mail.emergenus.com/mailman3/lists, but gives a 404 page not found.
If I go to lists.emergenus.com, it redirects to lists.emergenus.com/mailman3/lists and gives the nice postorius page, and works fine.
So, I'm trying to figure out how to stop that redirect.
When I look at my nginx access.log file for mail.emergenus.com, I see:
174.212.104.153 - - [28/Dec/2021:21:03:21 -0500] "GET /mailman3/lists/ HTTP/1.1" 404 188 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.93 Safari/537.36"
Aha! says I. My ip address is 203.159.80.234, not 174.212.104.153.
Thus, uwsgi (I think) is sneaking in there and taking over regardless
of what I'm trying to do.
Is there a way to tell mailman to only take over for lists.emergenus.com and not for www.emergenus.com or mail.emergenus.com?
Here's my uwsgi.ini (without then env= PYTHONPATH change discussed in another thread:
# /etc/mailman3/uwsgi.ini # [uwsgi] # Port on which uwsgi will be listening. http-socket = 0.0.0.0:8000 # If running uwsgi from the virtual environment ... virtualenv = /opt/mailman/venv/
module=mailman_web.wsgi:application # Add to python import path. pythonpath = /etc/mailman3/ # The default settings module. env = DJANGO_SETTINGS_MODULE=settings
# Setup default number of processes and threads per process. master = true processes = 2 threads = 2
# Setup the django_q related worker processes. attach-daemon = /opt/mailman/venv/bin/mailman-web qcluster
# Setup the request log. req-logger = file:/opt/mailman/web/logs/uwsgi.log
# Log qcluster commands separately. logger = qcluster file:/opt/mailman/web/logs/uwsgi-qcluster.log log-route = qcluster uwsgi-daemons
# Last log and it logs the rest of the stuff. logger = file:/opt/mailman/web/logs/uwsgi-error.log
Here's my /etc/nginx/sites-enabled/emergenus.com looks like:
server {
root /var/www/html2;
index index.html index.htm index.nginx-debian.html;
server_name emergenus.com, mail.emergenus.com,
www.emergenus.com;
location /{
try_files $uri $uri/ =404;
}
##### added 12/19
listen 443 ssl default_server; listen [::]:443 ssl default_server; ##########
ssl_certificate /etc/letsencrypt/live/emergenus.com/fullchain.pem;
# managed by Certbot ssl_certificate_key /etc/letsencrypt/live/emergenus.com/privkey.pem; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
server_name lists.emergenus.com;
location /{
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-Proto $scheme; proxy_redirect off; }
listen 443 ssl ; listen [::]:443 ssl ;
location /static/ { alias /opt/mailman/web/static/; }
##########
ssl_certificate /etc/letsencrypt/live/emergenus.com/fullchain.pem;
# managed by Certbot ssl_certificate_key /etc/letsencrypt/live/emergenus.com/privkey.pem; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server { if ($host = mail.emergenus.com) { # return 301 https://$host$request_uri; return 301 https://mail.emergenus.com; } # managed by Certbot
if ($host = www.emergenus.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
if ($host = lists.emergenus.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80 ;
listen [::]:80 ;
server_name www.emergenus.com lists.emergenus.com
mail.emergenus.com emergenus.com; return 404; # managed by Certbot
}
Thanks
billo