Setting Up Virtual Hosts

Presently I've got Mountain Lion and Mountain Lion Server.app running and successfully hosting a live website.  I've got mail running fine and profile manager, but I've not yet been able to figure out how to host a secondary site on a subdomain of my primary domain (though I suppose www is technically a subdomain).
I'm guessing the main thing I don't understand is if I need a secondary Primary Zone and other DNS settings requirements.  Also, anything else I need to do inside Server.app and possibly any items that need to be taken care of in Terminal.  I sure wish someone was doing tutorials that went beyond the inital domain out there, but I'm not seeing them.
I just need the steps to walk through, or a link to a tutorial, that I could use.
Thanks in advance!!!

Yes, www.example.com needs a translation that leads to an IP address, as does xyz.www.example.com.
Here's a writeup on DNS on OS X Server and here's one on Apache virtual hosting on OS X Server.
There are a number of ways to set up internal DNS — I'm here assuming you're using NAT — and external DNS. 
In general, I'd recommend using one registered domain inside and another registered domain outside, and a firewall that can "reflect" references to your external IP address back into your internal network.  This means you can maintain your internal (private) DNS completely separately from external (public) DNS. 
But read the articles above and see if you understand a bit better — or if you should have questions on either, ask away.

Similar Messages

  • Setting up Virtual Hosts on a Snow Leopard Development Server

    Hi Everybody,
    I'm losing hair over this - I thought it would be simple!
    I have set up a Mac Mini Server running SLS and would like to host multiple websites for development on the internal network. I require the websites to be stored anywhere on the server, not just in Library/WebServer/Documents/. Ideally, I would like to access them by example.com/mynewsite so I don't have to mess around with DNS.
    Currently I'm setting up websites in the Server Admin Web panel but it just doesn't work. I've noticed the error log keeps looking for files located in the Library/WebServer/Documents/ folder even though I have specified a different folder.
    What Am I missing? Does anybody know of a tutorial / guide to point out potential issues when setting up virtual hosts? I have checked Apple's guide but it doesn't really help me. Any pointers would be much appreciated!
    Cheers

    Sites is likely failing here because Sites is based on the DNS and on the HEAD command within the http stream; if the DNS does not match, you won't get to the host, and if the HEAD command doesn't match the entry in the site, then you'll either get the * wildcard or (if no *) you won't be transferred to the target Site.
    Check the web server logs, as a start.
    If you want to see how this stuff works at the protocol level, you could telnet to port 80 and toss a http 1.1 GET / command and see what you get back for a page.
    Per [rfc2616|http://tools.ietf.org/html/rfc2616], this sequence looks like this:
    +telnet www.example.com 80+
    then:
    +GET / HTTP/1.1+
    +host: www.example.com+
    followed by two presses of the return key, and where www.example.com is your target Site (virtual host) name.
    Alternatives to using DNS and virtual hosts are port-based hosting (which is easy), and you can also use IP addresses to establish virtual hosts. The former is set up via the Sites stuff, with various other ports being used for the web servers. Ugly, but easy. The IP-based approach can get ugly fast, too.
    If you get DNS going and aliases added, and all this goes away in a puff of greasy orange smoke.

  • Setting up Virtual Host in Apache for UCM Sites

    As the subject says: I am trying to setup virtual hosts in apache for UCM Sites. Now we are trying to set it up so for every site in UCM we have one ip address. So on the browser when I see someone typed in "http://www.myfirstsite.com" (through the magic of dns they get routed to my server). Once they are at the server in Apache I want to setup virtual hosts so I can redirect user to the proper site residing in UCM.
    Now, it is possible for me to access the sites by doing this "http://myservername/myfirstsite". But what I want to setup in Apache is that when someone types in "http://www.myfirstsite.com" they see which ever site I want them to see in UCM. But mann I just don't know what would be the document root or how would I go about getting the users to SEE what I want them to see. Can anyone help me with this please? Thanks in advance.

    You should be able to stick with the default apache config where it will answer for any hostname and create virtual hosts for each instance with the document root appropriate for that CS instance. Then you should be able use rewrite rules to direct users to the appropriate virtual host depending on what URL they access the server with. Check out the documentation for Apache around mod_rewrite: http://httpd.apache.org/docs/current/rewrite/

  • How to set up Virtual Hosts in Apache (OS X Server 10.9)

    I want to host more than one website on my mac mini with OS X Server 10.9
    1.) I edited /etc/apache2/httpd.conf for uncommenting the include line:
    # Virtual hosts
    Include /private/etc/apache2/extra/httpd-vhosts.conf
    2.) I edited /etc/apache2/extra/httpd-vhosts.conf and added:
    <VirtualHost *:80>
        ServerName cammino-al-dente.net
        ServerAlias www.cammino-al-dente.net
        DocumentRoot "/Library/Server/Web/Data/Sites/cammino-al-dente.net"
        ErrorLog "/private/var/log/apache2/cammino-al-dente.net.com-error_log"
        CustomLog "/private/var/log/apache2/cammino-al-dente.net-access_log" common
        ServerAdmin [email protected]
    </VirtualHost>
    <VirtualHost *:80>
        ServerName sutterer.net
        ServerAlias www.sutterer.net
        DocumentRoot "/Library/Server/Web/Data/Sites/sutterer.net"
        ErrorLog "/private/var/log/apache2/sutterer.net-error_log"
        CustomLog "/private/var/log/apache2/sutterer.net-access_log" common
        ServerAdmin [email protected]
    </VirtualHost>
    3.) then I edited /etc/hosts/ to spoof my IP address to the domains:
    127.0.0.1
    localhost
    127.0.0.1
    cammino-al-dente.net
    127.0.0.1
    www.cammino-al-dente.net
    127.0.0.1
    sutterer.net
    127.0.0.1
    www.sutterer.net
    255.255.255.255
    broadcasthost
    ::1        
    localhost
    fe80::1%lo0
    localhost
    Then I restarted Apache...But nothing happens :-(
    I could reach my website cammino-al-dente.net only by using the Server Default-entry, chancing the entry to my cammino...-folder
    Regards
    Fred Mario

    In the /etc/apache2/extra/httpd-vhosts.conf file check this line exists:
    NameVirtualHost *:80
    This solve same issue for me.
    I hope it's help.

  • Set up Named Based Virtual Hosting on 10.4 Server

    First, sorry for the stupid question. I've read through Apple's WebTechnologies_Adminv10.4/10.5 manuals and still don't feel like I have a clear answer to this question.
    I am trying to set up named based Virtual Hosting on an Xserve running 10.4. I have read a lot of instructions on the web on setting up named based virtual hosting on Mac 10.4/5 Client computers by manually adjusting the host and httpd.conf files and I'm confused as to whether I need to do this in 10.4 Server as well. I have successfully set up virtual hosting on a client computer and it works but I can't get it to work on 10.4 server. I have set up two sites in Server Admin with two site folders in /library/webserver/documents but no luck. Do I need to do what I did in the files above on the server to get it to work or should it work by just creating seperate sites in Server Admin? What am I missing? Thanks in advance for any guidance.

    You can do this entirely in Server Admin - no need to edit the config files directly.
    You just need to create each site in Server Admin -> (server) -> Web -> Sites
    For each set you need to specify the hostname for the site in each site's Domain Name field.
    As long as each site has a unique name (and that name maps to your server's IP address) that's all there is to it.

  • Virtual Host Setting

    Hi, im having APEX application running on 8080 port. I have set the virtual host redirection to the application.
    My virtual host setting is:
    <VirtualHost *:8080>
    ServerName hostname.com
    ServerAlias hostname.com
    Port 80
    RewriteEngine On
    RewriteRule ^/$ /pls/apex/f?p=118:1 [R=301]
    SimulateHttps on
    </VirtualHost>
    But im not able to access to access the apllication without giving the port name.
    http://hostname.com is not working but http://hostname.com:8080 is working ..
    Any input is appreciated.

    Got it working. It seems Port 80 is replaced by Listen 80 in Apache 2.0
    But SimulateHttps on is not working.
    The error is:
    Syntax error on line 1074 of E:/product/httpserver_home/ohs/conf/httpd.conf:
    Invalid command 'SimulateHttps', perhaps mis-spelled or defined by a module not included in the server configuration

  • Setting virtual host

    Im trying to set virtual host to my APEX application running on DB 11g. I come to know that chages had to made to the mod_reqrite module to set the virtual host.., to redirect to the particular page in the application hitting the server url. But the mod_rewrite module which is under ohs\modules is uneditable format/encrypted.
    Any help how to setup the virtual host is appreciated.

    Arun,
    >> But the mod_rewrite module which is under ohs\modules is uneditable format/encrypted
    That is expected. All Apache modules are compiled binary shared objects. You are not to edit the binaries themselves. You are expected to control mod_rewrite through directives in your Oracle HTTP Server configuration.
    http://httpd.apache.org/docs/2.0/vhosts/
    I hope this helps.
    Joel

  • Working with virtual host & hosts files on a local network

    I'm setting up a small local web and production server here in my office running Leopard.
    I'm setting up virtual hosts for users on the network to review and comment on websites in development. Ideally they'd access it as:
    host1.webserver.local
    host2.webserver.local
    host3.webserver.local
    Problem is, users on the network can see webserver.local just fine, but the subdomains need to be registered with hosts file on each computer.
    Is there a way I can manage all computers hosts file easily? I was thinking of an SVN repository, but this still requires going to each computer to update the file.
    Any suggestions here would be great.
    Thanks
    Rich

    Hi jscher2000
    Thank you for your interest.
    I am using "manual prxoy configuration" option in firefox with port 8080. I have tried the option of "Use system proxy settings" but it doesn't help.

  • For David Powers - Apache 2.2 and php 5.2. Virtual hosts

    Hi David,
    I have updated to the latest Apache and PHP
    Apache 2.2 and php 5.2. Must easier instal,
    But now I'm setting up Virtual hosts to make it easier to use
    php
    includes and DW templates.
    I have followed instructions on page 86 of above book, but I
    can't
    find the section NameVirtual Host on Apache's httpd.conf and
    it is
    much shorter than 950 lines.
    Malcolm N_
    ~Malcolm N....
    ~

    On Sun, 21 Jan 2007 11:49:47 -0000, "Dave Buchholz"
    <[email protected]> wrote:
    >Malcolm,
    >
    >a different David I know but you will find an updated
    tutorial on the "real"
    >David's site here
    http://foundationphp.com/tutorials/apache22_vhosts.php
    Many thanks David - I had found his revised tutorial on
    installing
    Apache - but I must have missed the bit on virtual hosts.
    That's great - I've not got all my sites working as virtual
    hosts (:-)
    Now to play with relative links / links to php include files
    in
    templates. !!!
    I'm going to try to get headers, footers and nav panels etc
    out of the
    main template(s), and do what Murray has been nagging
    everyone to do
    for ages.....
    I wasn't getting on well with that with before !! - standby
    for more
    questions.
    I had to read two of David's excellent books about three
    times - eh !.
    Malcolm
    ~Malcolm N....
    ~

  • Do OS-X style Virtual Hosts work in 10.5.5?

    The tips for setting up virtual hosting I've seen in these discussions suggest that OS X Virtual Hosting wasn't working before. Is it now or do I need to edit things with Terminal?

    pterobyte wrote:
    The instructions in the PDF you refer to do not say that you will get separate mailboxes, just how to associate multiple e-mail addresses with one account (=1 mailbox).
    From the PDF: "For example, if your domain is example.com and the virtual host domain is server.com, and you want mail addressed to [email protected] to be delivered to user bob, open bob’s user record in Workgroup Manager," and "This causes mail sent to your mail server for [email protected] to be actually sent to the real mail account for user bob. "
    This clearly states mail for [email protected] will go to user bob and not to a seperate mailbox.
    The very last line of that section (which you didn't quote) says "Meanwhile, mail to [email protected] will go to another designated mail account."
    I took that to mean that if [email protected] was also a short name under bob, then those two address = two mail boxes (so as each domain was under Virtual Hosts and not under aliases).
    Re-reading it now, I'd say that sentence is rather ambiguous. I can see how it could support what you say, but also how it leads me to believe what I did.
    Do you actually need separate mailboxes at all?
    Yep. It's only for a few people. Consultants who work under various domains, and need/want segregated mail boxes.
    I'm moving these accounts from a Communigate server where separate mailboxes are already the experence these people are accustomed to.
    At any rate, multiple users it is, and the 10-user revelation is also a a big help to know that creating multiple users is not an issue.
    It's a shame the GUI doesn't have Long Name and then a Domain field (which would then be used in User lists) -- kinda lame to have to write the Long Name with extra stuff to tell them apart. (without memorizing the IDs). I suppose I could manually assign ID ranges to imply my own arbitrary groupings. 1200+ = domain x, 1500+ = domain y ? Not very explicit though.
    Thanks for the discussion.
    -- gw

  • Dreamweaver CS5 with PHP, not getting it to work with virtual Host

    I have not got far with the book so far.  I am still on the second chapter where you set the Virtual Host but after setting up the Dreamweaver site definition and doing the test.  I get the error that page cannot be found.
    I ask if I can mail the text file of the http.conf and the httpd-vhosts.conf to anyone to see if I screwed up somewhere .  I am running on Windows 7 with the WAMP setup.

    Mr. Powers,
    I used your included file httpd-vhosts.conf.  And it did something since now I get a new set of errors.
    ( ! ) Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0
    ( ! ) Fatal error: Unknown: Failed opening required  'C:/vhosts/phpcs5/lesson02/site_check.php'  (include_path='.;C:\php\pear') in Unknown on line 0
    But I checked the properties of the folders and unchecked the 'read only' permission but still gets checked again.  I am using Windows 7 64-bit.
    I checked on the web nobody says any solutions about it, they only imply that is a permissions issue.
    I apologize, I found out the chapter files were encrypted... thanks

  • Virtual Hosts Issues

    I have a fresh install of Mac OS X 10.4 Server, and am having some problems setting up virtual hosts. I have 2 sites I'd like to host. Both are configured under the Sites tab of Web services. Both are pointing to different web folders. Both are using the same IP (the only IP this server has), and both are using port 80.
    Regardless of which site I try to access, I always get the first sites default page. I've already checked to make sure it's not a caching issue, and I have turned on the vhostaliasmodule.
    I've read through some old posts on this subject, but haven't found a solution that works yet. Any one know how to resolve this? Thanks!

    Ha!
    I finally figured it out.
    In httpd.conf, at the end of the file there's a section stating to use all of the .conf files in the /etc/httpd/sites directory. Seemingly, Mac OS X Server sets up every site as a virtual host, and creates a .conf file for each site in this directory. The issue ended up being that the directive in http.conf was:
    Include "/etc/httpd/sites/*.conf"
    I removed the quotes and both of my virtual hosts are working now.
    I don't know if this is a bug, or if there's supposed to be some other way to make this work.
    Thanks for the help from all of you!

  • Virtual Hosts in Apache HTTP Server

    How to configure virtual hosts in Apache HTTP Server httpd.conf file.
    If I want to access my server with some other name(alias), how can I do this ?
    Suggestions in this matter would be highly helpful.
    Thanks
    Vidhyut Arora

    Following is a note explaining how to setup
    Virtual hosts.
    Hope this helps
    Ranga
    Note:70647.1
    Subject: Apache Server Virtual Hosting
    Last Revision Date: 07-JUN-2001
    PURPOSE
    This document discusses considerations for setting up virtual hosts on an
    Apache machine, to include how to get the hostname working and how to
    configure Apache.
    SCOPE & APPLICATION
    The information in this document is intended for those who manage multiple sites
    using an Apache machine.
    REFERENCES
    First published in Apache Week issue 31 (6th September 1996)
    Last update 20th September 1998
    Using Virtual Hosts
    Virtual Hosts let you run multiple independent Web sites on a single host with
    a single Apache setup.
    One of the most important facilities in Apache is its ability to run virtual
    hosts. This is now the essential way to run multiple Web services - each with
    different host names and URLs - that appear to be completely separate sites.
    This is widely used by ISPs, hosting sites and content providers who need to
    manage multiple sites but do not want to buy a new machine for each one.
    Picking an IP address
    There are two types of virtual hosts: IP-based and non-IP-based. The former is
    where each virtual host has its own IP address. You must have a new IP address
    for each virtual host you want to set up, either from your existing allocation
    or by obtaining more from your service provider. When you have extra IP
    addresses, you tell your machine to handle them. On some operating systems, you
    can give a single ethernet interface multiple addresses (typically with an
    fconfig alias command). On other systems, you must have a different
    physical interface for each IP address (typically by buying extra ethernet
    cards).
    IP addresses are a resource that costs money and are increasingly difficult to
    get, so modern browsers can now also use 'non-IP' virtual hosts. This
    lets you use the same IP address for multiple host names. When the server
    receives an incoming Web connection, it does not know the hostname that was used
    in the URL. However, the new HTTP/1.1 specification adds a facility where the
    browser must tell the server the hostname it is using, on the Host: header. If
    an older browser connects to a non-IP virtual host, it does not send the Host:
    header, so the server must respond with a list of possible virtual
    hosts. Apache provides some help for configuring a site for both old and new
    browsers.
    Picking a Hostname and Updating the DNS
    Having selected an IP address, the next stage is to update the DNS so that
    browsers can convert the hostname into the right address. The DNS is the system
    that every machine connected to the internet uses to find the IP address of host
    names. If your hostname is not in the DNS, no one can connect to
    your server (except by the unfriendly IP address).
    If the virtual hostname you are going to use is under your existing domain,
    you can just add the record into your own DNS server. If the virtual hostname
    is in someone else's domain, you must get them to add it to their DNS
    server files. In some cases, you want to use a domain not yet used on the
    internet, in which case you must apply for the domain name from the
    InterNIC and set up the primary and secondary DNS servers for it, before adding
    the entry for your virtual host.
    In any of these cases, the entry you need to add to the DNS is an address record
    (an A record) pointing to the appropriate IP address. For example, say you want
    the domain www.my-dom.com to access your host with IP address 10.1.2.3: you
    must add the following line to the DNS zone file for my-dom.com:
    www A 10.1.2.3
    Now, users can enter http://www.my-dom.com/ as a URL in their browsers and get
    to your Web server. However, it will return the same information as if the
    machine's original hostname had been used. So, the final stage is to tell Apache
    how to respond differently to the different addresses.
    How Apache Handles Virtual Hosts
    Configuring Apache for virtual hosts is a two-stage process. First, it needs
    to be told which IP addresses (and ports) to listen to for incoming Web
    connections. By default, Apache listens to port 80 on all IP addresses of the
    local machine, and this is often sufficient. If you have a more complex
    requirement, such as listening on various port numbers, or only to specific IP
    addresses, then the BindAddress or Listen directives can be used.
    Second, having accepted an incoming Web connection, the server must be
    configured to handle the request differently, depending on what virtual host it
    was addressed to. This usually involves configuring Apache to use a different
    DocumentRoot.
    Telling Apache Which Addresses to Listen To
    If you are happy for Apache to listen to all local IP addresses on the port
    specified by the Port directive, you can skip this section. However, there are
    some cases where you want to use the directives explained here:
    - If you have many IP addresses on the machine but only want to run a Web
    server on some of them
    - If one or more of your virtual hosts is on a different port
    - If you want to run multiple copies of the Apache server serving different virtual
    hosts
    There are two ways of telling Apache what addresses and ports to listen to:
    - Use the BindAddress directive to specify a single address or port
    - Use the Listen directive to any number of specific addresses or ports
    For example, if you run your main server on IP address 10.1.2.3 port 80, and a
    virtual host on IP 10.1.2.4 port 8000, you would use:
    Listen 10.1.2.3:80
    Listen 10.1.2.4:8000
    Listen and BindAddress are documented on the Apache site.
    Configuring the Virtual Hosts
    Having gotten Apache to listen to the appropriate IP addresses and ports, the
    final stage is to configure the server to behave differently for requests on
    each of the different addresses. This is done using <VirtualHost> sections in
    the configuration files, normally in httpd.conf.
    A typical (but minimal) virtual host configuration looks like this:
    <VirtualHost 10.1.2.3>
    DocumentRoot /www/vhost1
    ServerName www.my-dom.com
    </VirtualHost>
    This should be placed in the httpd.conf file. You replace the text
    10.1.2.3 with one of your virtual host IP addresses. If you want to specify a
    port as well, follow the IP address with a colon and the port number
    (example: 10.1.2.4:8000). If omitted, the port defaults to 80.
    If no <VirtualHost> sections are given in the configuration files, Apache
    treats requests from the different addresses and ports identically. In terms of
    setting up virtual hosts, we call the default behavior the main server
    configuration. Unless overridden by <VirtualHost> sections, the main server
    behaviour is inherited by all the virtual hosts. When configuring virtual
    hosts, you must decide what changes to make in each of the virtual
    host configurations.
    Any directives inside a <VirtualHost> section apply to just that virtual host.
    The directives either override the configuration give in the main server, or
    supplement it, depending on the directive. For example, the DocumentRoot
    directive in a <VirtualHost> section overrides the main server's DocumentRoot,
    while AddType supplements the main server's mime types.
    Now, when a request arrives, Apache uses the IP address and port it arrived on
    to find a matching virtual host configuration. If no virtual host matches the
    address and port, it is handled by the main server configuration. If it does
    match a virtual host address, Apache uses the configuration of that virtual
    server to handle the request.
    For the example above, the server configuration used is the same as the
    main server, except that the DocumentRoot is /www/vhost1, and the
    ServerName is www.my-dom.com. Directives commonly set in <VirtualHost>
    sections are DocumentRoot, ServerName, ErrorLog and TransferLog. Directives
    that deal with handling requests and resources are valid inside <VirtualHost>
    sections. However, some directives are not valid inside <VirtualHost> sections,
    including BindAddress, StartSevers, Listen, Group and User.
    You can have as many <VirtualHost> sections as you want. You can
    leave one or more of your virtual hosts being handled by the main server, or
    have a <VirtualHost> for every available address and port, and leave the main
    server with no requests to handle.
    VirtualHost sections for non-IP Virtual Hosts
    Non-IP virtual hosts are configured in a very similar way. The IP address that
    the requests arrive on is given in the <VirtualHost> directive, and the
    host name is put in the ServerName directive. The difference is that there
    (usually) is more than one <VirtualHost> section handling the same IP address.
    For Apache to know whether a request arriving on a particular IP
    address is supposed to be a name-based requests, the NameVirtualHost directive
    addresses for name-based requests. A virtual host can handle more than one
    non-IP hostname by using the ServerAlias directive, in addition to the
    ServerName.
    null

  • Apache virtual hosts

    Hello,
    I have a enabled http access to my G4 and also FTP. I now would like to host my other sites.
    How can I enable virtual hosting?
    I have looked at documentation relating to this but have come unstuck as I have tried to look for the areas in the httpd.conf file that controls this. I think I found it but I'm not at all unix or command-line savvy so I don't wish to stuff it up. I have also looked through Apaches' on line documentation but I cant find any straight forward "this is what to change and this is how to change it" document. There seems to be much to do through terminal in order to allow virtual hosts, and there is also security which I believe is contained in other apache files. The mac is standalone and I think I need to allow it to be inetd? Is that right?
    Is there alternative software apart from apple server, that a novice like me can learn from or allow me to set these up through a gui?
    Thanks for your help

    Hi--
    sorry for the delay in responding have been away for
    xmas, will ask for advice on the apache boards,
    You can also ask for advice here. Unless the Apache boards have an area specifically for Apache on OS X, you could get confusing advice. Apple's Apache uses a different file layout than Linux, for example. Also, the Apache on OS X is still version 1.3, so you can get confusing advice there, too.
    but I
    will give nedit a go to see what it does.
    If you find nedit too daunting to install (it requires X Windows, for example, so you'd need that), you should look at Bare Bones' TextWrangler (if you're not already using BBedit, that is). You can use it to open the Apache configuration files. There's even an Apache Configuration Language module that works with TextWrangler. To install it into TextWrangler, just substitute "TextWrangler" in the path given on the Daring Fireball page. It works like a champ with either BBEdit or TextWrangler.
    Do you think it would be worth
    investing in apple server?
    If all you want to do is to set up virtual hosts on your computer, I don't think it's worth it. I haven't used the GUI tools for setting up so I don't know how good they are, though.
    But it's pretty simple to set up a virtual host on regular OS X. Basically, you open up the Apache configuration file. If you're using TextWrangler, and you installed the command line tool, it's as easy as typing this in the Terminal application:
    <pre class="command">edit /etc/httpd/httpd.conf</pre>TextWrangler will take care of the proper authentication when it comes time to make changes or save your file.
    The first thing to look for in your httpd.conf file is the NameVirtualHost directive. By default, it's commented out (has a "#" in front of the line):
    <pre class="command">#NameVirtualHost *:80</pre>Just remove the "#" from the front of the line.
    Then, a little further down, there's an example host but it's commented out:
    <pre class="command">#<VirtualHost *:80>
    # ServerAdmin [email protected]
    # DocumentRoot /www/docs/dummy-host.example.com
    # ServerName dummy-host.example.com
    # ErrorLog logs/dummy-host.example.com-error_log
    # CustomLog logs/dummy-host.example.com-access_log common
    #</VirtualHost></pre>I always leave that alone, but start my virtual hosts just below that. It can be as simple as this:
    <pre class="command"><VirtualHost *>
    DocumentRoot "/Library/WebServer/sitedirectory"
    ServerName www.domain.com
    </VirtualHost></pre>You can, however, get fancy and add all kinds of directives into that block, customizing your virtual host as much as you want. My suggestion would be to try setting up a virtual host and see where you get stuck, then post back with questions.
    As for messing up the httpd.conf file, don't worry about it too much. There's a "default" copy of the file in the /etc/httpd directory that you can always go back to. Or, do what I do before I'm about to try something that could turn ugly: make a copy of the current configuration file:
    <pre class="command">sudo cp /etc/httpd/httpd.conf /etc/httpd/httpd.conf.cmbak.1</pre>Where I just incremement the "1" on the end. Or I put the date on there: httpd.conf.cmbak.20061229. That way, I always have the current file to fall back on...
    And don't forget: any time you make a change to the httpd.conf file, you have to stop and restart the web server! That's so easy to forget. Also, if you're changing the configuration, these two Terminal commands will be your friends:
    <pre class="command">/usr/sbin/apachectl configtest
    /http -S</pre>
    The first one tells you if you have any syntax errors in your configuration file, the second will tell you about your virtual host setup.
    charlie

  • Using Sendmail from a Virtual Host

    I'm testing some Perl CGI scripts which use sendmail to send out emails. These scripts are used by different organisations and I've set up a virtual host for each organisation. I'm finding that the script communicates with sendmail OK but the messages are not getting through and I see from the error log at /var/mail/ that these are being rejected with part of the error message being:
    "Final-Recipient: rfc822; *****@mac.com
    Action: failed
    Status: 5.1.1
    Remote-MTA: dns; smtp-mx1.mac.com
    Diagnostic-Code: smtp; 550 5.1.1 unknown or illegal alias: *****@mac.com"
    --183FD34686D.1210867525/EricMac.local
    Content-Description: Undelivered Message
    Content-Type: message/rfc822"
    What do I need to do to correct this?
    <Edited by Moderator>

    You'll see from my other posting that my problems with sendmail have been solved. I seem to be doing the same as you - testing Perl scripts on the Mac before uploading to the live server. I'm doing this with scripts for different clients and I've set up virtual hosts for each on the Mac, and I'm using ActiveState's IDE, Komodo, to do the testing.
    When I had my initial problems with sendmail I was told that I had to configure it. However I'm not using the Apache that comes with my MacBook Pro. I downloaded MAMP PRO from http://www.mamp.info/en/mamp-pro/ which provides Apache, MySQL and PHP already configured for the Mac and also allows virtual hosts to be set up easily - there is also a free version MAMP that provides these three but not the frills.
    It seems that sendmail is already configured in MAMP, at least I haven't done any configuration, and this might be your answer if you're still having problems with sendmail

Maybe you are looking for