1

On a server where the default host is http://JonathansCorner.com, I am trying to set a VirtualHost for http://media.pragmatometer.com. However, neither of the registered domains in Apache2's sites-enabled directory is pulling from the intended server.

The VirtualHost is defined as follows:

<VirtualHost *:80>
    ServerName media.pragmatometer.com
    ServerAlias media.ccachicago.pragmatometer.com
    DocumentRoot /home/jonathan/ccachicago/media
    <Directory "/home/jonathan/ccachicago/media/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        #Order deny,allow
        #Deny from all
        #Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>
    ServerAdmin CJSHayward@PObox.com
</VirtualHost>

Is there anything else I should be adding? I checked, and none of the other VirtualHosts answer to http://media.pragmatometer.com or http://media.ccachicago.pragmatometer.com.

What can I add so either of the previously mentioned URL's pulls from the DocumentRoot above?

--EDIT--

The default VirtualHost's config follows:

<VirtualHost *:80>
ServerAdmin CJSHayward@POBox.com

DocumentRoot /home/jonathan/mirror
<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>
<Directory /home/jonathan/>
    Options ExecCGI Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all
</Directory>

DirectoryIndex index.cgi index.html
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
    AllowOverride None
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all
</Directory>

ErrorDocument 404 /missing.html
ErrorDocument 500 /servererror.html
ErrorLog ${APACHE_LOG_DIR}/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog ${APACHE_LOG_DIR}/access.log combined

Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
    Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>

</VirtualHost>
| improve this question | | | | |
1

Please try IP-based Virtual Host in you configuration as below

NameVirtualHost IP-ADDR:80

<VirtualHost IP-ADDR:80>
ServerName first.domain.com
...
...
</VirtualHost>
<VirtualHost IP-ADDR:80>
ServerName second.domain.com
...
...
</VirtualHost>
| improve this answer | | | | |
0

Name-based virtual hosts for the best-matching set of virtualhosts are processed in the order they appear in the configuration. The first matching ServerName or ServerAlias is used, with no different precedence for wildcards (nor for ServerName vs. ServerAlias).

If a VirtualHost doesn't specify a ServerName, a server name will be inherited from the base server configuration. If no server name was specified globally, one is detected at startup through reverse DNS resolution of the first listening address. In either case, this inherited server name will influenced name-based virtual host resolution, so it is best to always explicitly list a ServerName in every name-based virtual host.

| improve this answer | | | | |
  • Thank you; I have added a ServerName and ServerAlias to the 000 host. It is back to serving up what is served before for each of the domains I was able to try. – Christos Hayward Jan 29 '14 at 15:43
  • I am a little confused now, what is 000 host? – Dusan Bajic Jan 29 '14 at 15:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.