• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 352
  • Last Modified:

apache vhosts on mac not being recognized

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.
Evan Cutler
Evan Cutler
  • 2
  • 2
1 Solution
Jesse BruffettM&F-ing SorcererCommented:
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.
Evan CutlerVolunteer Chief Information OfficerAuthor Commented:
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?

Jesse BruffettM&F-ing SorcererCommented:
Its near the bottom of the file. line 499
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
Evan CutlerVolunteer Chief Information OfficerAuthor Commented:
Thanks much.  Sorry, thought I closed this already.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now