Administration
  Home arrow Administration arrow Page 2 - The Soothingly Seamless Setup of Virtual Hosts and Certificates
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
Google.com  
ADMINISTRATION

The Soothingly Seamless Setup of Virtual Hosts and Certificates
By: Israel Denis Jr. and Eugene Otto
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 2
    2000-06-26


    Table of Contents:
  • The Soothingly Seamless Setup of Virtual Hosts and Certificates
  • Virtual Hosts Setup
  • Creating Certificates
  • Conclusion

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    The Soothingly Seamless Setup of Virtual Hosts and Certificates - Virtual Hosts Setup
    ( Page 2 of 4 )

    Now it is time to configure Apache to handle some virtual hosts. Virtual Hosting is quite simple to do because of the flexibilty that is offered by Apache. First, you need a DNS server to point the domain of the virtual host to the IP of the webserver. Use a CNAME record in the DNS to point your_virtual_domain.com to the server's IP. Second, you need to modify the Apache configuration file httpd.conf to add the new virtual domain. Remember, this is just a very basic example, we encourage you to read up on the Apache Directives.

    Let's look at a snippet of the httpd.conf:
    #---------------------------------------------------------------#
    # VIRTUAL HOST SECTION NON-SSL
    #---------------------------------------------------------------#
    # VirtualHost directive allows you to specify another virtual
    # domain on your server. Most Apache options can be specified
    # within this section.
    Listen 10.10.10.10:80
    <VirtualHost 10.10.10.10:80>

    # Mail to this address on errors
    ServerAdmin webmaster@domain1.com

    # Where documents are kept in the virtual domain
    # this is an absolute path. So you may want to put
    # in a location where the owner can get to it.
    DocumentRoot /home/vhosts/domain1.com/www/

    # Since we will use PHP to create basically
    # all our file we put a directive to the Index file.
    DirectoryIndex index.php

    # Name of the server
    ServerName www.domain1.com

    # Log files Relative to ServerRoot option
    ErrorLoglogs/domain1.com-error_log
    TransferLog logs/domain1.com-access_log
    RefererLog logs/domain1.com-referer_log
    AgentLoglogs/domain1.com-agent_log

    # Use CGI scripts in this domain. In the next case you
    # can see that it does not have CGI scripts. Please
    # read up on the security issues relating to CGI-scripting
    ScriptAlias /cgi-bin/ /var/www/cgi-bin/domain1.com/
    AddHandler cgi-script .cgi
    AddHandler cgi-script .pl
    </VirtualHost>
    Listen 10.10.10.20:80
    <VirtualHost 10.10.10.20:80>

    # This is another domain. Note that you could host
    # multiple domains this way...

    # Mail to this address on errors
    ServerAdmin webmaster@domain2.com

    # Where documents are kept in the virtual domain
    DocumentRoot /virtual/domain2.com/www/html

    # Name of the server
    ServerName www.domain2.com

    # Log files Relative to ServerRoot option
    ErrorLoglogs/domain2.com-error_log
    TransferLog logs/domain2.com-access_log
    RefererLog logs/domain2.com-referer_log
    AgentLoglogs/domain2.com-agent_log

    # No CGI's for this host
    </VirtualHost>

    # End: virtual host section

    Use the example above to help create virtual hosts on your server. If you want, you can read more about every directive at http://www.apache.org.


    #--------------------------------------------#
    # SSL Virtual Host Context
    #--------------------------------------------#
    Listen 10.10.10.30:80
    <VirtualHost 10.10.10.30:80>

    # General setup for the virtual host
    DocumentRoot /usr/local/apache/htdocs
    ServerAdminwebmaster@securedomain1.com
    ServerName www.securedomain1.com
    ErrorLoglogs/domain1.com-error_log
    TransferLoglogs/domain1.com-transfer_log

    # SSL Engine Switch:
    # Enable/Disable SSL for this virtual host.
    SSLEngine on

    # Server Certificate:
    # Point SSLCertificateFile at a PEM encoded certificate. If
    # the certificate is encrypted, then you will be prompted for a
    # pass phrase. Note that a kill -HUP will prompt again. A test
    # certificate can be generated with `make certificate' under
    # built time. Keep in mind that if you've both a RSA and a DSA
    # certificate you can configure both in parallel (to also allow
    # the use of DSA ciphers, etc.)
    # Note that I keep my certificate files located in a central
    # location. You could change this if you are an ISP, or ASP.

    SSLCertificateFile /usr/local/apache/conf/ssl.crt/server.crt

    # Server Private Key:
    # If the key is not combined with the certificate, use this
    # directive to point at the key file. Keep in mind that if
    # you've both a RSA and a DSA private key you can configure
    # both in parallel (to also allow the use of DSA ciphers, etc.)

    SSLCertificateKeyFile /usr/local/apache/conf/ssl.key/server.key

    # Per-Server Logging:
    # The home of a custom SSL log file. Use this when you want a
    # compact non-error SSL logfile on a virtual host basis.
    CustomLog /usr/local/apache/logs/ssl_request_log \
      "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
    </VirtualHost>

    Keep in mind that there are many more directives you can specify. We would need to cover those in an article related specifically to configuring Apache. This document is meant only to be an introductory guide to get you started.

     
     
    >>> More Administration Articles          >>> More By Israel Denis Jr. and Eugene Otto
     

       

    ADMINISTRATION ARTICLES

    - Network Booting via PXE: the Basics
    - Scalix: Linux Administrator`s Guide
    - Network Administration with FreeBSD 7
    - Components of an Information Architecture
    - The Anatomy of an Information Architecture
    - Configuring Load-Balanced Clusters
    - Load-Balanced Clusters
    - UNIX Time Format Demystified
    - Making Changes in the CVS
    - Building Your First CVS Repository
    - CVS Quickstart Guide
    - Authorizing Users in Samba
    - Handling User Accounts in Samba
    - Authentication in Samba
    - Accounts, Authentication, and Authorization





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek