Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & incrediBILL & phranque

Apache 2.2.22 on OSX 10.7.5 - VIRTUAL HOSTS NOT WORKING

Virtual Host Configuration

2:04 am on Sep 1, 2013 (gmt 0)

Have tried now for 4 days trying to get virtual hosts to work and simply CANNOT! Here is my apache config:

ServerRoot "/usr"
Listen 80
LoadModule authn_file_module libexec/apache2/mod_authn_file.so
LoadModule authn_dbm_module libexec/apache2/mod_authn_dbm.so
LoadModule authn_anon_module libexec/apache2/mod_authn_anon.so
LoadModule authn_dbd_module libexec/apache2/mod_authn_dbd.so
LoadModule authn_default_module libexec/apache2/mod_authn_default.so
LoadModule authz_host_module libexec/apache2/mod_authz_host.so
LoadModule authz_groupfile_module libexec/apache2/mod_authz_groupfile.so
LoadModule authz_user_module libexec/apache2/mod_authz_user.so
LoadModule authz_dbm_module libexec/apache2/mod_authz_dbm.so
LoadModule authz_owner_module libexec/apache2/mod_authz_owner.so
LoadModule authz_default_module libexec/apache2/mod_authz_default.so
LoadModule auth_basic_module libexec/apache2/mod_auth_basic.so
LoadModule auth_digest_module libexec/apache2/mod_auth_digest.so
LoadModule cache_module libexec/apache2/mod_cache.so
LoadModule disk_cache_module libexec/apache2/mod_disk_cache.so
LoadModule mem_cache_module libexec/apache2/mod_mem_cache.so
LoadModule dbd_module libexec/apache2/mod_dbd.so
LoadModule dumpio_module libexec/apache2/mod_dumpio.so
LoadModule reqtimeout_module libexec/apache2/mod_reqtimeout.so
LoadModule ext_filter_module libexec/apache2/mod_ext_filter.so
LoadModule include_module libexec/apache2/mod_include.so
LoadModule filter_module libexec/apache2/mod_filter.so
LoadModule substitute_module libexec/apache2/mod_substitute.so
LoadModule deflate_module libexec/apache2/mod_deflate.so
LoadModule log_config_module libexec/apache2/mod_log_config.so
LoadModule log_forensic_module libexec/apache2/mod_log_forensic.so
LoadModule logio_module libexec/apache2/mod_logio.so
LoadModule env_module libexec/apache2/mod_env.so
LoadModule mime_magic_module libexec/apache2/mod_mime_magic.so
LoadModule cern_meta_module libexec/apache2/mod_cern_meta.so
LoadModule expires_module libexec/apache2/mod_expires.so
LoadModule headers_module libexec/apache2/mod_headers.so
LoadModule ident_module libexec/apache2/mod_ident.so
LoadModule usertrack_module libexec/apache2/mod_usertrack.so
#LoadModule unique_id_module libexec/apache2/mod_unique_id.so
LoadModule setenvif_module libexec/apache2/mod_setenvif.so
LoadModule version_module libexec/apache2/mod_version.so
LoadModule proxy_module libexec/apache2/mod_proxy.so
LoadModule proxy_connect_module libexec/apache2/mod_proxy_connect.so
LoadModule proxy_ftp_module libexec/apache2/mod_proxy_ftp.so
LoadModule proxy_http_module libexec/apache2/mod_proxy_http.so
LoadModule proxy_scgi_module libexec/apache2/mod_proxy_scgi.so
LoadModule proxy_ajp_module libexec/apache2/mod_proxy_ajp.so
LoadModule proxy_balancer_module libexec/apache2/mod_proxy_balancer.so
LoadModule ssl_module libexec/apache2/mod_ssl.so
LoadModule mime_module libexec/apache2/mod_mime.so
LoadModule dav_module libexec/apache2/mod_dav.so
LoadModule status_module libexec/apache2/mod_status.so
LoadModule autoindex_module libexec/apache2/mod_autoindex.so
LoadModule asis_module libexec/apache2/mod_asis.so
LoadModule info_module libexec/apache2/mod_info.so
LoadModule cgi_module libexec/apache2/mod_cgi.so
LoadModule dav_fs_module libexec/apache2/mod_dav_fs.so
LoadModule vhost_alias_module libexec/apache2/mod_vhost_alias.so
LoadModule negotiation_module libexec/apache2/mod_negotiation.so
LoadModule dir_module libexec/apache2/mod_dir.so
LoadModule imagemap_module libexec/apache2/mod_imagemap.so
LoadModule actions_module libexec/apache2/mod_actions.so
LoadModule speling_module libexec/apache2/mod_speling.so
LoadModule userdir_module libexec/apache2/mod_userdir.so
LoadModule alias_module libexec/apache2/mod_alias.so
LoadModule rewrite_module libexec/apache2/mod_rewrite.so
LoadModule bonjour_module libexec/apache2/mod_bonjour.so
LoadModule php5_module libexec/apache2/libphp5.so
#LoadModule fastcgi_module libexec/apache2/mod_fastcgi.so

<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
User _www
Group _www

ServerAdmin you@example.com
DocumentRoot "/usr/htdocs"

<Directory />
# Options FollowSymLinks
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order deny,allow

<Directory "/usr/htdocs">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all


<IfModule dir_module>
DirectoryIndex index.html

<FilesMatch "^\.([Hh][Tt]|[Dd][Ss]_[Ss])">
Order allow,deny
Deny from all
Satisfy All

<Files "rsrc">
Order allow,deny
Deny from all
Satisfy All
<DirectoryMatch ".*\.\.namedfork">
Order allow,deny
Deny from all
Satisfy All

ErrorLog "/private/var/log/apache2/error_log"

LogLevel warn

<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

<IfModule logio_module>
# You need to enable mod_logio.c to use %I and %O
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio

CustomLog "/private/var/log/apache2/access_log" common

<IfModule alias_module>
ScriptAliasMatch ^/cgi-bin/((?!(?i:webobjects)).*$) "/Library/WebServer/CGI-Executables/$1"


<IfModule php5_module>
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
<IfModule dir_module>
DirectoryIndex index.html index.php

<IfModule cgid_module>
# ScriptSock: On threaded servers, designate the path to the UNIX
# socket used to communicate with the CGI daemon of mod_cgid.
#Scriptsock /private/var/run/cgisock

<Directory "/Library/WebServer/CGI-Executables">
AllowOverride None
Options None
Order allow,deny
Allow from all

DefaultType text/plain

<IfModule mime_module>
TypesConfig /private/etc/apache2/mime.types
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz

TraceEnable off

<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin

NameVirtualHost *:80

<VirtualHost *.80>
ServerName www.xxx.com.local
DocumentRoot /usr/htdocs/www.xxx.com/
ServerAlias *.xxx.com.local
ErrorLog /var/log/apache2/www.xxx.com.local-error_log
CustomLog /var/log/apache2/www.xxx.com.local-access_log common

<VirtualHost *.80>
ServerName www.zzz.com.local
DocumentRoot /usr/htdocs/www.zzz.com/
ServerAlias *.zzz.com.local
ErrorLog /var/log/apache2/www.zzz.com.local-error_log
CustomLog /var/log/apache2/www.zzz.com.local-access_log common

<VirtualHost *.80>
ServerName yyy.com
DocumentRoot /usr/htdocs/yyy.com/
ServerAlias *.yyy.com
ErrorLog /var/log/apache2/www.yyy-error_log
CustomLog /var/log/apache2/www.yyy-access_log common

Running apachectl - S provides following;

Sun Sep 01 11:00:41 2013] [error] (EAI 8)nodename nor servname provided, or not known: Could not resolve host name *.80 -- ignoring!
[Sun Sep 01 11:00:41 2013] [error] (EAI 8)nodename nor servname provided, or not known: Could not resolve host name *.80 -- ignoring!
[Sun Sep 01 11:00:41 2013] [error] (EAI 8)nodename nor servname provided, or not known: Could not resolve host name *.80 -- ignoring!
httpd: Could not reliably determine the server's fully qualified domain name, using NAME-LAPTOP-MacBook-Pro.local for ServerName
[Sun Sep 01 11:00:41 2013] [warn] NameVirtualHost *:80 has no VirtualHosts
VirtualHost configuration:
Syntax OK

Content of /etc/hosts is: localhost yyy.com www.xxx.com.local www.zzz.com.local

No matter what I do, when I run a browser and go to a vhost, it just gives me the doc root and shows the 3 dirs representing the 3 sites I have.

Any help would be very very very very much appreciated.

3:18 am on Sep 1, 2013 (gmt 0)

10+ Year Member

Change <VirtualHost *:80>

<VirtualHost ipaddress:80>
<VirtualHost ipaddress:80 ipaddress2:80 ....>

ipaddress can be internal or external.
3:42 am on Sep 1, 2013 (gmt 0)

AHHHHH,..... u guided me to the error. I have .80 in the virtual host declaration and it should have been :80! A needle in a haystack! Anyway, many thanks!
4:08 am on Sep 1, 2013 (gmt 0)

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month

... and once it's working, change this bit

<Directory />
AllowOverride All

unless you are 100% certain that you know better than the Apache docs :) Or if it's just meant to be temporary while you get the server running, where "temporary" = no more than 72 hours. Overrides in deeper directories will depend on circumstances.

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month