I'm using Apache/2.4.16 on FreeBSD 10.2. I have two instances of Apache running, each serving several domain names. The server has two network interfaces, one for the public Internet, one only accessible through my internal LAN. All of the virtual host configuration files are nearly identical except for the domain names and directories. All of the sites work as expected, except for one: If I try to go to adultemployment.net, I get the server's default page, but if I specify any of the machine names configured in the DNS (www, ftp, mail, etc.) I get the site's page as expected, e.g., www.adultemployment.net displays correctly.
This is the virtual host configuration file for adultemployment.net:
<VirtualHost 100.0.193.102:80 192.168.14.202:80>
ServerName AdultEmployment.net
ServerAlias *.AdultEmployment.net
ServerAdmin webmaster@AdultEmployment.net
DocumentRoot "/path.to/adultemploy/www"
<Directory "/path.to/adultemploy/www">
Options All MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorDocument 404 /cgibin/badurl.pl
ErrorLog "|/usr/local/sbin/rotatelogs /path.to/adultemploy/logs/error_log 86400"
CustomLog "|/usr/local/sbin/rotatelogs /path.to/adultemploy/logs/access_log 86400" combined
<IfModule mod_alias.c>
ScriptAlias /cgibin/ "/path.to/adultemploy/cgibin/"
<Directory "/path.to/adultemploy/cgibin">
AllowOverride None
Options None
Require all granted
</Directory>
</IfModule>
</VirtualHost>
This is the virtual host configuration file for another site (which works correctly), bidsadult.com:
<VirtualHost 100.0.193.102:80 192.168.14.202:80>
ServerName BidsAdult.com
ServerAlias *.BidsAdult.com
ServerAdmin webmaster@BidsAdult.com
DocumentRoot "/path.to/bidsadult/www"
<Directory "/path.to/bidsadult/www">
Options All MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorDocument 404 /cgibin/badurl.pl
ErrorLog "|/usr/local/sbin/rotatelogs /path.to/bidsadult/logs/error_log 86400"
CustomLog "|/usr/local/sbin/rotatelogs /path.to/bidsadult/logs/access_log 86400" combined
<IfModule mod_alias.c>
ScriptAlias /cgibin/ "/path.to/bidsadult/cgibin/"
<Directory "/path.to/bidsadult/cgibin">
AllowOverride None
Options None
Require all granted
</Directory>
</IfModule>
</VirtualHost>
The default and virtual host configurations are set in httpd.conf:
# 'Main' server configuration
#
# The directives in this section provide defaults for any
# <VirtualHost> containers you may define later in the file.
#
# All of these directives may appear inside <VirtualHost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
#
ServerAdmin webmaster@occupant591.net
ServerName generic.occupant591
#
<Directory />
AllowOverride none
Require all denied
</Directory>
#
<IfModule dir_module>
DirectoryIndex index.php index.cgi index.shtml index.htm index.html
</IfModule>
#
<Files ".ht*">
Require all denied
</Files>
#
LogLevel info
<IfModule log_config_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
<IfModule ssl_module>
LogFormat "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b" ssl_request
</IfModule>
<IfModule logio_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
</IfModule>
<IfModule cgid_module>
Scriptsock logs/cgisock
</IfModule>
<IfModule mime_module>
TypesConfig conf/mime.types
AddType application/x-httpd-php .php
AddType application/x-tar .tgz
AddType text/plain .xml
AddType image/x-icon .ico
AddEncoding x-compress .Z
AddEncoding x-gzip .gz .tgz
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddHandler cgi-script .cgi
AddHandler cgi-script .pl
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
</IfModule>
<FilesMatch "\.php$">
SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch "\.phps$">
SetHandler application/x-httpd-php-source
</FilesMatch>
<Location /cgi-bin/phf*>
Deny from all
ErrorDocument 403 http://phf.apache.org/phf_abuse_log.cgi
</Location>
<Location /cgibin/phf*>
Deny from all
ErrorDocument 403 http://phf.apache.org/phf_abuse_log.cgi
</Location>
# 'Main' server configuration
#
# The directives in this file set up the values used by the 'main'
# server, which responds to any requests that aren't handled by any
# other <VirtualHost> definition.
#
Include /path.to.apache.config/conf/generic.site
# Virtual hosts
Include /path.to.apache.config/conf/ActiveSites/*.conf
The default site configuration is set by generic.site:
<VirtualHost 100.0.193.102:80 192.168.14.202:80>
ServerAdmin webmaster@occupant591.net
DocumentRoot "/path.to/generic/www"
<Directory "/path.to/generic/www">
Options All MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorDocument 404 /cgibin/badurl-occ.pl
ErrorLog "|/usr/local/sbin/rotatelogs /path.to/generic/logs-occ/error_log 86400"
CustomLog "|/usr/local/sbin/rotatelogs /path.to/generic/logs-occ/access_log 86400" combined
<IfModule mod_alias.c>
ScriptAlias /cgibin/ "/path.to/generic/cgibin/"
<Directory "/path.to/generic/cgibin">
AllowOverride None
Options None
Require all granted
</Directory>
</IfModule>
</VirtualHost>
I've tried to fix this by copying a functional configuration file onto the one for adultemployment.net and updating the domain name and directory entries. That didn't change anything. I've tried several different sets of ServerName and ServerAlias entries, such as
ServerName www.AdultEmployment.net
ServerAlias *.AdultEmployment.net AdultEmployment.net
and
ServerName www.AdultEmployment.net
ServerAlias *.AdultEmployment.net
I thought the problem might be because adultemployment.net was alphabetically first in the ActiveSites directory, so I added another domain to precede it - and that site works as expected, but adultemployment.net still doesn't return its page without a machine name.
At first I thought it might be a browser cache issue, but I get the same behavior accessing the site from Firefox and IE on my w2K machine, Firefox on my w7 laptop, and lynx ssh'd into an outside hosting company's shell. I also tried clearing the arp entry for the domain on the server, to no avail.
I've tried tweaking the DNS entries, and looked for symlinks as suggested here or .htaccess entries as suggested here for similar problems, but nothing seems to fix this problem where one site on the server fails, but all of the others work correctly.
I've been trying to fix this problem for over a week, intermittently when I first discovered it, and almost continuously for the past two days. Any hints or pointers would be greatly appreciated!!