2

I am creating a set up of Mailman, Apache2.4 and Postfix. My problem is as follows. When I access the mailing list with the domain name, I get the correct result in my browser. Here the picture

Normal mailman front page

However if I try to access directly using my server's IP address, I get a different page, where the mailing lists are missing. This is how it looks like:

enter image description here The desired result is getting exactly the same page.

The apache2 configuration is as follows:

<Directory /usr/lib/cgi-bin/mailman/>
    AllowOverride None
    Options +ExecCGI
    AddHandler cgi-script .cgi
    # (Old apache2.2 style configuration:)
    # Order allow,deny
    # Allow from all
    # New apache 2.4 configuration:
    Require all granted
</Directory>
<Directory /var/lib/mailman/archives/public/>
    Options FollowSymlinks
    AllowOverride None
    # (Old configuration:)
    # Order allow,deny
    # Allow from all
    # New apache 2.4 configuration:
    Require all granted
</Directory>
<Directory /usr/share/images/mailman/>
    AllowOverride None
    # (Old configuration:)
    # Order allow,deny
    # Allow from all 
    # New apache 2.4 configuration:
    Require all granted
</Directory>


<VirtualHost *:80>
ServerName lists.example.org
DocumentRoot /var/www/lists
ErrorLog /var/log/apache2/lists-error.log
CustomLog /var/log/apache2/lists-access.log combined

<Directory /var/lib/mailman/archives/>
    Options FollowSymLinks
    AllowOverride None
</Directory>

Alias /archives/ /var/lib/mailman/archives/public/
Alias /images/mailman/ /usr/share/images/mailman/
ScriptAlias /admin /usr/lib/cgi-bin/mailman/admin
ScriptAlias /admindb /usr/lib/cgi-bin/mailman/admindb
ScriptAlias /confirm /usr/lib/cgi-bin/mailman/confirm
ScriptAlias /create /usr/lib/cgi-bin/mailman/create
ScriptAlias /edithtml /usr/lib/cgi-bin/mailman/edithtml
ScriptAlias /listinfo /usr/lib/cgi-bin/mailman/listinfo
ScriptAlias /options /usr/lib/cgi-bin/mailman/options
ScriptAlias /private /usr/lib/cgi-bin/mailman/private
ScriptAlias /rmlist /usr/lib/cgi-bin/mailman/rmlist
ScriptAlias /roster /usr/lib/cgi-bin/mailman/roster
ScriptAlias /subscribe /usr/lib/cgi-bin/mailman/subscribe
ScriptAlias /mailman/ /usr/lib/cgi-bin/mailman/
ScriptAlias / /usr/lib/cgi-bin/mailman/listinfo/
</VirtualHost>

EDIT: I include here my mm_cfg.py file (Mailman configuration):

from Defaults import *

MAILMAN_SITE_LIST = 'mailman'

DEFAULT_URL_PATTERN = 'http://%s/'
# PRIVATE_ARCHIVE_URL = '/cgi-bin/mailman/private'
PUBLIC_ARCHIVE_URL = 'http://%(hostname)s/archives/%(listname)s'
IMAGE_LOGOS         = '/mailman-icons/'

# Default domain for email addresses of newly created MLs
DEFAULT_EMAIL_HOST = 'lists.example.org'

# Default host for web interface of newly created MLs
DEFAULT_URL_HOST   = 'lists.example.org'

VIRTUAL_HOSTS.clear()
add_virtualhost(DEFAULT_URL_HOST,DEFAULT_EMAIL_HOST)

DEFAULT_SERVER_LANGUAGE = 'en'
USE_ENVELOPE_SENDER    = 0              # Still used?
DEFAULT_SEND_REMINDERS = 0
MTA='Postfix'

Besides that, I disable the default site by running:

sudo a2dissite 000-default

I noticed that if I don't disable 000-default, accessing the webpage using the IP address gives me the default Apache page that says everything is ok.

I wonder if there is some elegant solution to the direct IP access problem, making it show the same page as the one I see when I use the domain name.

EDIT: I tried changing to (Inside mm_cfg.py):

VIRTUAL_HOSTS.clear()
add_virtualhost("104.131.98.138","lists.example.org")

As suggested. I get the correct page when I use the url lists.example.org, however when I use the IP address I get this: Entering mailman directly using IP

Note however that this time the email address is correct.

I get the same results also when both lines are present:

VIRTUAL_HOSTS.clear()
add_virtualhost(DEFAULT_URL_HOST,DEFAULT_EMAIL_HOST)
add_virtualhost("104.131.98.138","lists.example.org")

1 Answer 1

1

First, pardon me for misdirection here because I misunderstanding your intention in the past. Now, as far as I understand, your intention is aliasing 104.131.98.138 to lists.freedomlayer.org - so when you browse through either 104.131.98.138 and lists.freedomlayer.org you get same result - YES?

Unfortunately, it isn't possible with mailman. Mailman expect single unique URL for every list. More info, click this FAQ from mailman documentation

Anyway you can set redirection in Apache. So whenever user doesn't use http://lists.freedomlayer.org to go to mailman web page (i.e. using http://104.131.98.138) it will redirected to http://lists.freedomlayer.org.

Here the apache config to get your redirection works

RewriteEngine On
RewriteCond %{HTTP_HOST} !^lists\.freedomlayer\.org [NC]
RewriteRule ^(.*)$ http://lists.freedomlayer.org/$1 [R=301,L]
8
  • 1
    Thanks for the answer. I tried adding the line as suggested. I still have two different pages though. This time in the access through IP address case I get the mail address as [email protected] (Earlier It was mailman@ip-address), so it did make some difference.
    – real
    Commented Nov 23, 2014 at 15:41
  • @real two suggestions: (1) could you replace add_virtualhost(DEFAULT_URL_HOST,DEFAULT_EMAIL_HOST) with add_virtualhost('192.168.99.99', 'lists.example.com') in mm_cfg.py and restart mailman (2) If it still fails please post the screenshot also :)
    – masegaloeh
    Commented Nov 24, 2014 at 1:53
  • 1
    Thanks again for your message. I tried replacing the lines, however I get similar results. If it helps somehow, the full configuration is here: github.com/realcr/mailman_docker
    – real
    Commented Nov 25, 2014 at 10:35
  • Thanks, for the docker. However when I tried to play it in my bare new VPS, it doesn't works because permission issue.
    – masegaloeh
    Commented Nov 26, 2014 at 4:19
  • As docker expects to run as root, you should add sudo to all of my scripts. Did the permission issue showed up from the host, or inside the container?
    – real
    Commented Nov 26, 2014 at 14:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .