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
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:
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:
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")