Web Servers

    In order to provide applications with clean URLs, distributions ship with a set of .htaccess files for use with Apache, which will handle URL rewriting.

    By default, these files can be utilized by finding all references to AllowOverride in your httpd.conf configuration file and setting the values to All. On an OS X system, your setup may look something like this:

    Once you’ve made sure AllowOverride has been set correctly, you can toss a project in your DocumentRoot. Using the past example, placing the project in /Library/WebServer/Documents/project would allow you to access your application at http://localhost/project.

    In production, it is recommended that you set AllowOverride to None and instead, create a <VirtualHost /> configuration pointed at your application’s webroot directory, which contains the rewrite rules. For example, if your application is located in /var/www/html/project, your configuration would resemble the following:

    1. <VirtualHost *:80>
    2. ServerName example.com
    3. DocumentRoot "/var/www/html/project/app/webroot"
    4. ErrorLog "logs/error_log"
    5. RewriteEngine On
    6. RewriteCond %{REQUEST_FILENAME} !-f
    7. RewriteCond %{REQUEST_FILENAME} !favicon.ico$
    8. RewriteRule ^ index.php [QSA,L]
    9. </Directory>
    10. </VirtualHost>

    In this case, your app is available at http://example.com.

    Nginx requires a simple rewrite configuration that enables it to serve dynamic URLs. With nginx, each domain has its own configuration file that encapsulates all such rewriting rules.

    The following example file is typically stored at /etc/nginx/sites-available/example.org.conf. All instances of example.org can be replaced with the domain name of your site or application.

    IIS Is a Microsoft-supplied product which manages many internet services—one of them being HTTPD—that comes standard on most Windows machines.

    • Internet Information Services
    • Internet Information Services Hostable Web Core

    For a quick setup, check both. If you want to remove specific features, you can expand “Intenernet Information Services” and remove unwanted features.

    Once this is done you can now locate IIS within your Start menu or find it through search by typing “IIS”.

    To make IIS work well with li3’s pretty URL system, install the URL Rewrite extension located on the iis.net website and follow the proper installation instructions located there.

    Next, follow the setup instructions for for either IIS 6.0 or .

    Setup a site by right clicking “Sites” and click “Add Web Site”

    1. Enter your website name.
    2. Enter the physical path to your application’s webroot directory (\path\to\lithium\app\webroot).
    3. Optional: If your content is in your home directory, click “Connect As” and click “Specific User”. From therec enter your Windows login details, as this will allow IIS to have proper access to the application.
    4. Enter the desired port.
    5. Click “OK”.
    1. Locate your site in the “Sites” tree and click it.
    2. Locate the URL Rewrite icon from the extension installed earlier.
    3. On the right hand side under “Inbound Rules” click “Import Rules”
    4. Click the ellipsis (…) next to the field box and locate the .htaccess file within your \path\to\lithium\app\webroot\ directory and select it.
    5. Click “Import”.

    Your li3 application should now be accessible via IIS.


    Tested with IIS7 (which is shipped with Windows 7).

    This quick guide is meant to help Lighty users get a development setup running in order to create li3 apps served up by Lighttpd. Lighttpd is a web server designed and optimized for high-performance production environments. It has a small memory footprint, yet contains a rich feature set. If you’re planning on using li3 and Lighttpd together, this guide is for you.

    You can download a copy of Lighty on the official website. Once downloaded, follow the instructions to get a running instance.

    Let us assume for this example that you’re developing locally and would like your app to be accessible at http://lithium.local/li3.

    First, enable mod_magnet in your lighttpd.conf.

    1. server.modules += ( "mod_magnet" )

    Then, save the following script in a file named li3.lua, preferably somewhere near your lighttpd.conf.

    Finally, in your lighttpd.conf, add the following conditional:

    1. server.document-root = "/path/to/your/app/webroot/"
    2. magnet.attract-physical-path-to = ( "/path/to/li3.lua" )
    3. }

    You’ll probably need to add a line item in your /etc/hosts file as well:

    Restart your lighttpd process, and you’re done!

    Caddy is a new HTTP/2 web server with automatic HTTPS written in Go. It is pretty fast and easy to learn. You can get a quick start reading the chapter from the documentation.

    To make use of Caddy and be able to start the Caddy Server with the command caddy there has to be a Caddyfile present. This file resides in the root directory of the project.

    1. localhost:2020
    2. gzip
    3. root app/webroot
    4. fastcgi / localhost:9000 php
    5. log app/resources/tmp/logs/access.log
    6. errors app/resources/tmp/logs/error.log
    7. rewrite / {
    8. if {file} not favicon.ico

    If you want to run Caddy with different plugins, check their documentation for a list of all possible directives.