0

I am trying to configure multiple virtual hosts on a new Ubuntu 13.10 installation as a development server. It only needs to serve to itself. Apache Server version: Apache/2.4.6 (Ubuntu)

I've read http://httpd.apache.org/docs/2.4/vhosts/name-based.html https://help.ubuntu.com/13.04/serverguide/httpd.html and many other sites trying to figure this out.

http://localhost is working but http://ncacaa.local is NOT FOUND. What am I missing??? ping http://nacaa.local returns ping: unknown host http://ncacaa.local

Here is the content of the /etc/apache2/sites-available/ncacaa.conf

<VirtualHost *:80>
    DocumentRoot "/var/www/vhosts/htdocs-ncacaa"
    ServerName ncacaa.local
    ErrorLog "/var/log/apache2/ncacaa.localhost-error.log"
    <Directory "/var/www/vhosts/htdocs-ncacaa">
       Order allow,deny
       Allow from all
       Require all granted
    </Directory>
</VirtualHost>

There is a symbolic link to it in the sites-enabled directory created by a2ensite

Here is what is not commented out in the 000-default.conf file:

<VirtualHost *:80>
    ServerAdmin john@***.com
    DocumentRoot /var/www
    <Directory "/var/www">
            AllowOverride FileInfo
            Options Indexes FollowSymLinks
            Order allow,deny
            Allow from all
            Require all granted
    </Directory>
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Here is what is not commented out in the apache.conf file:

Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}
HostnameLookups Off
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
LogLevel warn
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Require all denied
</Directory>
<Directory /usr/share>
    AllowOverride None
    Require all granted
</Directory>
<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>
AccessFileName .htaccess
<FilesMatch "^\.ht">
    Require all denied
</FilesMatch>
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
IncludeOptional conf-enabled/*.conf
IncludeOptional sites-enabled/*
ServerName localhost:80

Thanks in advance!

1 Answer 1

4

There will also need to be a line in the config to turn on virtual hosting:

NameVirtualHost *:80

Though the error "ping http://nacaa.local returns ping: unknown host http://ncacaa.local" means your dns is not resolving. You need to add to /etc/hosts or set up dns.

Sign up to request clarification or add additional context in comments.

1 Comment

Adding NameVirtualHost made the VHosting to work on Apache 2.4 for me. Thank you

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.