[Techtalk] Apache 2.2 - Virtual host redirecting to default domain if file isn't specified
Terry
tech at futurecourse.com
Sun Apr 26 23:01:31 UTC 2015
Hi folks,
Seriously newbie Debian Squeeze apache2 question. My google-fu is
failing me. We're cleaning up the old server at linuxchix.org for a
move to a new VM. Yay!
What changed during the cleanup:
1. Removed the symlinks in sites-enabled for some really old sites.
2. Removed a symlink in mods-enabled that was incorrect and causing a
module to try to load twice.
3. Both the ports.conf file and the default vhost file had
NameVirtualHost directives.
ports.conf: NameVirtualHost *:80
default vhost: NameVirtualHost *
All of the vhost files had <VirtualHost *>.
Did some googling and removed the NameVirtualHost * directive in the
default vhost file and changed all the vhost files to <VirtualHost *.80>
Warnings gone. Yay!
Now there's a new problem. If I go to http://courses.linuxchix.org or
http://mailman.linuxchix.org or http://live.linuxchix.org, I get
redirected to the default site, www.linuxchix.org. :(
I can access all the subdomains *if* the URL contains a file name.
Example: http://courses.linuxchix.org/index.html works fine.
Syntax looks fine. Output of apachectl -t -D DUMP_VHOSTS
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:80 is a NameVirtualHost
default server www.linuxchix.org
(/etc/apache2/sites-enabled/000-www.linuxchix.org:6)
port 80 namevhost www.linuxchix.org
(/etc/apache2/sites-enabled/000-www.linuxchix.org:6)
port 80 namevhost courses.linuxchix.org
(/etc/apache2/sites-enabled/courses.linuxchix.org:3)
port 80 namevhost live.linuxchix.org
(/etc/apache2/sites-enabled/live.linuxchix.org:2)
port 80 namevhost mailman.linuxchix.org
(/etc/apache2/sites-enabled/mailman.linuxchix.org:3)
Syntax OK
I've googled until I'm blue in the face and can't figure out what's
causing this to happen. I know next to nothing about apache2 and have
followed every troubleshooting guide I could find. The VirtualHost
configuration has no syntax errors and lists the right virtual hosts.
No errors are showing up in any error logs.
Any help/guidance would be greatly appreciated. I did check to make
sure there is no wildcard *.linuxchix.org domain set anywhere and there
isn't.
Enabled vhost files below sig.
--
Terry
www.linuxchix.org:
<VirtualHost *:80>
ServerName www.linuxchix.org
ServerAlias linuxchix.org
ServerAdmin sysadmin at linuxchix.org
RedirectToServerName on
DocumentRoot /home/drupal/drupal
CustomLog /var/log/apache2/www.linuxchix.org-access.log
combined
ErrorLog /var/log/apache2/www.linuxchix.org-error.log
php_value error_log /var/log/apache2/www.linuxchix.org-error.log
LogLevel crit
# Don't show directory listings for URLs which map to a directory.
Options -Indexes
# Follow symbolic links in this directory.
Options +FollowSymLinks
DirectoryIndex index.php
# Temporary alias while the courses are ported, retain after launch
Alias /content/courses /var/www/temporary-courses-archive
</VirtualHost>
<Directory /var/www/temporary-courses-archive>
Options +Indexes MultiViews
DirectoryIndex index.html
</Directory>
<Files "cron.php">
order deny,allow
deny from all
allow from 127.0.0
allow from 140.211.166.107
</Files>
courses.linuxchix.org
<VirtualHost *:80>
ServerName courses.linuxchix.org
ServerAlias www.courses.linuxchix.org
DocumentRoot /var/www/courses-static
CustomLog
/var/log/apache2/courses.linuxchix.org-access.log combined
ErrorLog /var/log/apache2/courses.linuxchix.org-error.log
LogLevel warn
</VirtualHost>
live.linuxchix.org:
<VirtualHost *:80>
ServerName live.linuxchix.org
Redirect permanent /rss.xml http://www.linuxchix.org/aggregator/rss
RedirectMatch permanent ^/$ http://www.linuxchix.org/live
Redirect gone /atom.xml
Redirect gone /opml.xml
Redirect gone /foafroll.xml
Redirect gone /common.css
Redirect gone /stylesheet.css
RedirectMatch gone /heads/.*\.png
CustomLog /var/log/apache2/live.linuxchix.org-access.log
combined
ErrorLog /var/log/apache2/live.linuxchix.org-error.log
LogLevel warn
</VirtualHost>
mailman.linuxchix.org:
<VirtualHost *:80>
ServerName mailman.linuxchix.org
ServerAdmin sysadmin at linuxchix.org
ServerAlias hub.linuxchix.org
RedirectToServerName on
ScriptAlias /mailman/ /usr/lib/cgi-bin/mailman/
Alias /pipermail/ /var/lib/mailman/archives/public/
Alias /pipermail /var/lib/mailman/archives/public/
RedirectMatch ^/$ /mailman/listinfo
<Directory /var/lib/mailman/archives/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/apache2/mailman.linuxchix.org-error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/mailman.linuxchix.org-access.log combined
ServerSignature On
Include
/etc/apache2/sites-available/includes/mailman.linuxchix.org-redirects-moved-sites
</VirtualHost>
mailman.linuxchix.org-redirects-moved-sites:
# Mailman URLs to all go to one address only
Redirect permanent /mailman http://mailman.linuxchix.org/mailman
Redirect permanent /cgi-bin/mailman http://mailman.linuxchix.org/mailman
Redirect permanent /pipermail http://mailman.linuxchix.org/pipermail
More information about the Techtalk
mailing list