Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

apache vhosts on mac not being recognized

Posted on 2016-10-17
5
Medium Priority
?
148 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
[X]
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
  • 2
  • 2
5 Comments
 
LVL 4

Accepted Solution

by:
jessbruffett earned 2000 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 4

Expert Comment

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

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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
Article by: Justin
In light of the WannaCry ransomware attack that affected millions of Windows machines, you might wonder if your Mac needs protecting. Yes, it does and here is how to do it.
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 …
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

721 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