?
Solved

Setting Up Name Based Virtual Hosts in MAC Lion Server

Posted on 2011-09-14
4
Medium Priority
?
815 Views
Last Modified: 2012-05-12
I've been trying to set up Lion server to host multiple websites.

i've done a bunch of research and it seems to be a big problem and there seems to be many workarounds available, i've tried a few and have not been able to get any of them to work.

Does anybody know of a solid procedure to use?

Which configuration files would i need to modify? How would i modify them without breaking the rest of Apache?

Thanks for your help!
0
Comment
Question by:Cybervanes
[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
4 Comments
 
LVL 79

Expert Comment

by:arnold
ID: 36540338

If you only have one, you would have to place it in the main configuration file
prior to the first virualhost entry where the default site is defined.
NameVirtualHost *

<virtualhost *>
#default site

</VirtualHost

<virtualhost *>
ServerName www.somesite.com

</virtualhost>

etc.
http://soft.zoneo.net/Linux/remove_empty_lines.php

http://soderlind.no/archives/2011/08/26/running-wordpress-locally-on-mac-os-x-lion/ has a link to a guide which might be more useful to you.

useful command apachectl configtest can be used to detect whether the changes you made are incorrect i.e. will cause an error and might prevent apache from starting.
0
 
LVL 2

Author Comment

by:Cybervanes
ID: 36540380
so if i wanted to take it a step further and and add multiple sites with specific paths i would use:

<VirtualHost *:80>
ServerName www.domain.tld
DocumentRoot /www/domain
</VirtualHost>

<VirtualHost *:80>
ServerName www.otherdomain.tld
DocumentRoot /www/otherdomain
</VirtualHost>

after the first default site?

and thats all?

the main configuration file you are talking about is /etc/apache2/sites/0000_any_80_.conf or where would it be located?

thanks!
0
 
LVL 79

Accepted Solution

by:
arnold earned 1000 total points
ID: 36540665
Yes, but make sure you have the namevirtualhost * above the first site.

The links I posted provide a guide and examples.

You could add it in /etc/apache2/httpd.conf directly.
the example deals with setting up a mechanism that enables you to alter the configuration without elevating your rights which I would suggest you not follow.

It all depends on you, you could if not included at the bottom of httpd.conf
include conf.d/*.conf

What this provides is the ability for you to create domain.conf domain2.conf domain3.conf within /etc/apache2/conf.d that will minimize the entries/scope of data in /etc/apache2/httpd.conf while providing you with simpler management.

you might use the example they had with /etc/apache2/other instead of /etc/apache2/conf.d.

Note: you still need to include the NameVirtualHost * directive in httpd.conf above the default site's virtual host entry.

The conf files using * will relay to name based hosting,
Make sure to always backup the current copy prior to making any changes just in case.  Look into subversion which is a way to manage configuration files while subversion will maintain versions of the file just in case a change made leads to trouble.

0
 
LVL 2

Author Closing Comment

by:Cybervanes
ID: 36551258
ended up switching the ip address selection to the ip address of the server and that seems to have fixed it... doesn't make sense but it's working!
0

Featured Post

Connect further...control easier

With the ATEN CE624, you can now enjoy a high-quality visual experience powered by HDBaseT technology and the convenience of a single Cat6 cable to transmit uncompressed video with zero latency and multi-streaming for dual-view applications where remote access is required.

Question has a verified solution.

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

iCloud Drive was introduced after iOS 8 was launched last year. This drive is Apple’s online storage device that lets users sync their files and access them from all their Apple devices.   There is a lot of data that is not automatically backed up…
Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
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 …
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

777 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