<!--
 -  
 -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 -  project.
 -  
 -  Copyright (C) 1998-2018 OpenLink Software
 -  
 -  This project is free software; you can redistribute it and/or modify it
 -  under the terms of the GNU General Public License as published by the
 -  Free Software Foundation; only version 2 of the License, dated June 1991.
 -  
 -  This program is distributed in the hope that it will be useful, but
 -  WITHOUT ANY WARRANTY; without even the implied warranty of
 -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 -  General Public License for more details.
 -  
 -  You should have received a copy of the GNU General Public License along
 -  with this program; if not, write to the Free Software Foundation, Inc.,
 -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 -  
 -  
-->
<?xml version="1.0" encoding="ISO-8859-1"?>
<refentry id="VS-S-4">
  <refmeta>
    <refentrytitle>Web Server Setup</refentrytitle>
    <refmiscinfo>tutorial</refmiscinfo>
  </refmeta>
  <refnamediv>
    <refname>Examples of Mapping</refname>
    <refpurpose>Setting up a Secure Directory</refpurpose>
  </refnamediv>

<refsect1 id="VS-S-4a">
<title>Preliminaries</title>
<itemizedlist mark="bullet">
  <listitem>Space on the Web server can be explicitly mapped for SSL (HTTPS) connections.</listitem>
  <listitem>To start HTTPS listener, the server needs a valid certificate and private key pair.</listitem>
</itemizedlist>
</refsect1>

<refsect1 id="VS-S-4b">
<title>Using the Virtual Directories UI</title>
<itemizedlist mark="bullet">
  <listitem>Login to the Conductor UI using the dba account.</listitem>
  <listitem>Go to "Web Application Server" tab and then go to the "Virtual Domains &amp; Directories" tab.</listitem>
  <listitem>In the empty fields below the list of HTTP Listeners enter:</listitem>
  <listitem>In the "HTTP Host" field the qualified name of the host.</listitem>
  <listitem>In the "Interface" field the qualified name of the interface to listen to.</listitem>
  <listitem>In the "Port" field the port number to listen on.</listitem>
  <listitem>Press the "Add" button.</listitem>
  <listitem>Define the HTTP root location of this host. The root location can be mapped in file system, DAV or proxy server. In this example we will define a map in filesystem.</listitem>
  <listitem>Click the icon in front of the Interface value.</listitem>
   <listitem>Click the "Add new directory" link.</listitem>
  <listitem>Create a "/ssl" directory under the HTTPServer ServerRoot directory. This directory will be used to create the new mapping.</listitem>
  <listitem>Choose the "File System" type and press the button 'Next>>'.</listitem>
  <listitem>Enter for "Path" "/ssl" and enter "/ssl/" (or select this directory with "Browse" button) in the "Physical path" location.</listitem>
  <listitem>If you wish to make entire site to be executable specify the VSP user. (See also: VS-B-1 example)</listitem>
  <listitem>Select the "SSL" as "Security method"</listitem>
  <listitem><para>Enter for authentication options the files for the certificate and the private key of the server</para>
<programlisting>
https_cert=PATH_TO_THE_CERTIFICATE;
https_key=PATH_TO_THE_PRIVATE_KEY;
</programlisting></listitem>
  <listitem>Press the "Save Changes" button.</listitem>
  <listitem>If needed, more path mapping can be added to that defined.</listitem>
  <listitem>To test the definition enter http://[yourhost:port]/ in location box of your browser.</listitem>
</itemizedlist>
</refsect1>

<refsect1 id="VS-S-4c">
<title>Equivalent SQL commands for above</title>
<itemizedlist mark="bullet">
  <listitem>Connect to the Virtuoso server via ISQL utility as DBA user.</listitem>
  <listitem><para>Define a virtual directory mapping for the host alias:</para>
<programlisting>
SQL&gt; vhost_define (vhost=&gt;'[yourhost]:4333',lhost=&gt;'[yourhost]:4333',
                      lpath=&gt;'/',ppath=&gt;'/ssl/', def_page=&gt;'index.html',
		      is_brws=&gt;1, sec=&gt;'SSL',
		      auth_opts=&gt;vector ('https_cert','PATH_TO_THE_CERTIFICATE',
			'https_key','PATH_TO_THE_PRIVATE_KEY'));
</programlisting></listitem>
<listitem>Note that in the sample SQL script, 'localhost' is used instead of 'yourhost'. This MUST be replaced with the official host name. Also needs certificate an private keys to be in place, before trying this example; PATH_TO_THE_CERTIFICATE and PATH_TO_THE_PRIVATE_KEY MUST be replaced with actual path to these files.</listitem>
</itemizedlist>
</refsect1>
</refentry>
