Solved

apache vhosts on mac not being recognized

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

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

Open in new window



/private/etc/apache2/httpd.conf
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


/private/etc/apache2/extra/httpd-vhosts.conf
<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>

<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
</VirtualHost>

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

Open in new window


/private/etc/apache2/extra/vhosts/trekfed.conf
<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
    </Directory>

    # 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
        </Files>
    </Directory>

</VirtualHost>

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"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
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.
0
Comment
Question by:Evan Cutler
  • 2
  • 2
5 Comments
 
LVL 3

Accepted Solution

by:
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.
httpd.conf.txt
httpd-userdir.conf.txt
httpd-vhosts.conf.txt
username.conf.txt
0
 
LVL 9

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?

Thanks
0
 
LVL 3

Expert Comment

by:jessbruffett
ID: 41847473
Its near the bottom of the file. line 499
0
 
LVL 26

Expert Comment

by:skullnobrains
ID: 41849833
the vhost_alias module is not for name based virtual hosting the way you configure it
http://httpd.apache.org/docs/2.4/mod/mod_vhost_alias.html
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
/private/etc/apache2/extra/vhosts/trekfed.conf
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
0
 
LVL 9

Author Closing Comment

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

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Connectivity using SMB Symptoms When connecting to Windows Server shares from a Mac you receive an error similar to "Connection failed because the original item could not be found"Authentication persistently fails to a Windows Server from a Mac wi…
In this article we will discuss some EI Capitan Mail app issues and provide some manual process to resolve them.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

746 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now