Solved

apache vhosts on mac not being recognized

Posted on 2016-10-17
5
69 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

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

Suggested Solutions

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…
It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

914 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

18 Experts available now in Live!

Get 1:1 Help Now