Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

apache vhosts on mac not being recognized

Posted on 2016-10-17
Last Modified: 2016-10-21
I'm trying to enable vhosts, however for some reason it's not being recognized.

/etc/hosts   localhost broadcasthost
::1             localhost       trekfed.cutlerplace.net

Open in new window

LoadModule vhost_alias_module libexec/apache2/mod_vhost_alias.so

Open in new window

# Virtual hosts
Include /private/etc/apache2/extra/httpd-vhosts.conf

Open in new window

<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot "/usr/docs/dummy-host.example.com"
    ServerName dummy-host.example.com
    ServerAlias www.dummy-host.example.com
    ErrorLog "/private/var/log/apache2/dummy-host.example.com-error_log"
    CustomLog "/private/var/log/apache2/dummy-host.example.com-access_log" common

<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host2.example.com
    DocumentRoot "/usr/docs/dummy-host2.example.com"
    ServerName dummy-host2.example.com
    ErrorLog "/private/var/log/apache2/dummy-host2.example.com-error_log"
    CustomLog "/private/var/log/apache2/dummy-host2.example.com-access_log" common

Include /private/etc/apache2/extra/vhosts/*.conf

Open in new window

<VirtualHost *:80>

    LogLevel info

    ServerName trekfed.cutlerplace.net
    ServerAdmin cheng@trekfederation.com

    # Static files
    DocumentRoot "/Users/arcee123/Documents/trekfed"
    Alias /static/ /Users/arcee123/Documents/trekfed/static/

    <Directory "/Users/arcee123/Documents/trekfed/static">
        Order deny,allow
        Allow from all

    # WGSI configuration
    WSGIDaemonProcess trekfed.cutlerplace.net processes=2 threads=15 display-name=%{GROUP} python-path=/Users/arcee123/Documents/trekfed/:/Users/arcee123/Documents/VirtualEnvs/venv-trek/lib/python3.5/site-packages

    WSGIProcessGroup mysite.com

    WSGIScriptAlias / /Users/arcee123/Documents/trekfed/trekfed/wsgi.py

    <Directory "/Users/arcee123/Documents/trekfed">
        <Files wsgi.py>
            Order allow,deny
            Allow from all


Open in new window

When I perform a apachectl -S, This is the response:
VirtualHost configuration:
ServerRoot: "/usr/local/opt/httpd24"
Main DocumentRoot: "/usr/local/var/www/htdocs"
Main ErrorLog: "/usr/local/var/log/apache2/error_log"
Mutex default: dir="/usr/local/var/run/apache2/" mechanism=default
Mutex mpm-accept: using_defaults
PidFile: "/usr/local/var/run/apache2/httpd.pid"
User: name="daemon" id=1
Group: name="daemon" id=1

Open in new window

when I run apachectl configtest I'm expecting warnings for the two vhosts, and any warnings (if needed) for the other one. but the only response I get is Syntax OK

What am I missing? I can't tell what I'm missing to get the vhosts going. The only response I get from putting the vhost address into the browser is the default apache response.
Question by:Evan Cutler
  • 2
  • 2

Accepted Solution

jessbruffett earned 500 total points
ID: 41847361
ok where to start... first you dont need the "Include /private/etc/apache2/extra/httpd-vhosts.conf" in your vhost file. that file is solely for the configs for the individual vhost records. second there is a vhost module in the httpd file that needs to be uncommented. you need to configure your username.conf file and enable in in the httpd.conf. im including copies of properly configured httpd, username, user-dir and vhost files so you can get a better feel for how it should look. the big thing is in OS X you dont use seperate vhost config files, its all done in the http-vhosts.conf file. your /etc/hosts files is correct. look at the files im attaching and youll see what i mean.

Author Comment

by:Evan Cutler
ID: 41847378
I'm a bit confused.   what second vhost module?
I looked at your httpd.conf file, and I saw the module and the include.
Where else should I be looking?


Expert Comment

ID: 41847473
Its near the bottom of the file. line 499
LVL 27

Expert Comment

ID: 41849833
the vhost_alias module is not for name based virtual hosting the way you configure it
i never tried to use both at the same time but it seems fairly possible it gets in the way

and you need to include the
which does not seem to be included by default
you can include .../vhosts/*.conf which is the regular way to configure vhosts in separate files

Author Closing Comment

by:Evan Cutler
ID: 41854480
Thanks much.  Sorry, thought I closed this already.

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question