[sf-lug] need for .html suffix

Sean sean.channel at pacbell.net
Wed Jun 13 08:24:41 PDT 2012


I, too, have not tried virtual hosts, though lighttpd-doc includes some short 
write-ups; please see attached 'simple-vhost' and 'evhost'.

Agreed re: nginx.

HTH.
_S

On 06/12/2012 06:57 PM, Rick Moen wrote:

>> The next thing I'd like to try is to set up "name-based virtual hosts"
>> (as opposed to virtual interfaces) and I've read that lighttpd can do
>> this and that to do so might be even easier on lighttpd than it is on
>> Apache.
>
> Yeah, now, case in point:  If you were intending to ask the next server
> admin for an example of such a config and bumped into me, I could mail
> you an Apache httpd one, but not one for Lighty as I've never tackled
> that problem.  On the other hand, it's probably not difficult.
>
>> I've also considered nginx although haven't got to the point of installing
>> it to try it out. I found the books about it a bit daunting for my
>> level of expertise. It sounds as though nginx might be more appropriate
>> for installations much bigger than anything I'll ever run.
>
> Pretty much.  Standard use case for nginx is that you're planning to run
> some large, ponderous back-end Web server for content -- say, Java
> servlets or Ruby on Rails -- and need a front-end HTTP reverse proxy
> server (https://en.wikipedia.org/wiki/Reverse_proxy) to speed up the
> user experience.  nginx will do that.  There are also other uses.
-------------- next part --------------
======================
Simple Virtual-Hosting
======================

------------------------
Module: mod_simple_vhost
------------------------

:Author: Jan Kneschke
:Date: $Date: 2004/08/29 09:43:49 $
:Revision: $Revision: 1.1 $

:abstract:
  virtual hosting

.. meta::
  :keywords: lighttpd, virtual hosting

.. contents:: Table of Contents

Description
===========

Simple assumption:

Every virtual host is in a directory below a base directory in a path that
is the same as the name of the vhost. Below this vhost path might be an
extra directory which is the document root of the vhost.

The document root for each vhost is built from three values:

- server-root
- hostname
- document-root

The complete document root is constructed either by ::

  server-root + hostname + document-root

or if this path does not exist by ::

  server-root + default-host + document-root

A small example should make this idea clear: ::

  /var/www/
  /var/www/logs/
  /var/www/servers/
  /var/www/servers/www.example.org/
  /var/www/servers/www.example.org/lib/
  /var/www/servers/www.example.org/pages/
  /var/www/servers/mail.example.org/
  /var/www/servers/mail.example.org/lib/
  /var/www/servers/mail.example.org/pages/

  simple-vhost.server-root = "/var/www/servers/"
  simple-vhost.default-host = "www.example.org"
  simple-vhost.document-root = "pages"

You can use symbolic links to map several hostnames to the same directory.

Conditionals vs. simple-vhost
-----------------------------

You have to keep in mind that conditionals and simple-vhost interfere
with one another. ::

  simple-vhost.server-root = "/var/www/servers/"
  simple-vhost.default-host = "www.example.org"
  simple-vhost.document-root = "pages"

  $HTTP["host"] == "news.example.org" {
    server.document-root = "/var/www/servers/news2.example.org/pages/"
  }

When ``news.example.org`` is requested, the ``server.document-root``
will be set to ``/var/www/servers/news2.example.org/pages/``, but
simple-vhost will overwrite it shortly afterwards.

If ``/var/www/servers/news.example.org/pages/`` exists, that will be
used. If not, ``/var/www/servers/www.example.org/pages/`` will be taken
because it is the default.

To use conditionals together with simple-vhost, you should do this: ::

  $HTTP["host"] !~ "^(news\.example\.org)$" {
    simple-vhost.server-root = "/var/www/servers/"
    simple-vhost.default-host = "www.example.org"
    simple-vhost.document-root = "pages"
  }

  $HTTP["host"] == "news.example.org" {
    server.document-root = "/var/www/servers/news2.example.org/pages/"
  }

It will enable simple vhosting for all hosts other than ``news.example.org``.

Options
=======

simple-vhost.server-root
  root of the virtual host

simple-vhost.default-host
  use this hostname if the requested hostname does not have its own directory

simple-vhost.document-root
  path below the vhost directory

-------------- next part --------------
========================
Enhanced Virtual-Hosting
========================

------------------
Module: mod_evhost
------------------

:Author: Jan Kneschke
:Date: $Date: 2004/08/29 09:43:49 $
:Revision: $Revision: 1.1 $

:abstract:
  virtual hosting

.. meta::
  :keywords: lighttpd, virtual hosting

.. contents:: Table of Contents

Description
===========

mod_evhost builds the document-root based on a pattern which contains
wildcards. Those wildcards can represent parts if the submitted hostname


::

  %% => % sign
  %0 => domain name + tld
  %1 => tld
  %2 => domain name without tld
  %3 => subdomain 1 name
  %4 => subdomain 2 name
  %_ => the complete hostname (without port info)

  evhost.path-pattern = "/home/www/servers/%3/pages/"

Options
=======

evhost.path-pattern
  pattern with wildcards to be replace to build a documentroot




More information about the sf-lug mailing list