Other HTTP Servers - Ubuntu as a Server - Ubuntu Unleashed 2017 Edition (2017)

Ubuntu Unleashed 2017 Edition (2017)

Part IV: Ubuntu as a Server

Chapter 26. Other HTTP Servers


In This Chapter

Image lighttpd

Image Yaws

Image Cherokee

Image Jetty

Image thttpd

Image Apache Tomcat

Image References


To determine the best web server for your use, consider the needs of the website you manage. Does it need heavy security (for e-commerce), multimedia (music, video, and pictures), or the capability to download files easily? How much are you willing to spend for the software? Do you need software that is easy to maintain and troubleshoot or that includes tech support? The answers to these questions might steer you to something other than what’s covered in Chapter 24, “Apache Web Server Management” or Chapter 25, “Nginx Web Server Management.”

lighttpd

lighttpd, or “lighty” is a speedy open-source lightweight server. Like Nginx, lighttpd is designed for high-performance and low resource use. YouTube, Wikipedia, and others are using lighttpd for its scalability and quickness. Also like Nginx, lighttpd uses an event-driven architecture.

One thing that sets lighttpd apart from Nginx is that while Nginx natively handles static content incredibly well, it can also require a bit more work to get it functioning as a server for CGI content, such as websites built with PHP. Obviously, because the main WordPress site that they host themselves uses Nginx and is built with PHP, this is not an insurmountable task with Nginx (and web tutorials abound). With lighttpd, this feature is built in, making it quicker to install, configure, and use if this is the sort of site you intend to host.

Configuring lighttpd is again done using a system of configuration files. The syntax is a bit different from either Apache or Nginx, but to anyone familiar with using either, lighttpd will be easy to understand and use.

Rewrite rules are available for lighttpd, and you can do them using conditionals and regular expressions. However, the syntax for doing this is different and takes a little time to study and use effectively.

lighttpd has a nice website with professional documentation available. Reading through it should give you a good sense of whether lighttpd is suitable for a specific site.

Yaws

Yaws stands for Yet Another Web Server. It is written in the Erlang programming language, which is enough to make it unique and interesting for many people. Erlang is primarily designed for and used to build scalable real-time systems that require high availability. It is often found in telephony applications, instant messaging, commerce, and banking, and it’s designed to support concurrency and fault tolerance. Yaws was written from the ground up to be scalable and multithreaded. Like newer versions of Apache, Yaws uses threads, in this case one thread per request, to serve content. What makes Yaws an interesting alternative is how the underlying language deals with concurrent processes. Because it uses Erlang, Yaws should be significantly faster, even using the same base method for serving content.

Yaws is configured using one configuration file. Virtual servers are the standard, and the syntax of the file is familiar enough that most simple configurations should be quick and easy to set up.

Rewrites are possible in Yaws, but not in the same manner as with Apache. Here is where a major weakness comes in: The documentation available from the Yaws website at the time of this writing was quite sparse, and much of it is outdated (this is acknowledged by the site with a disclaimer). The official site links to a user’s blog from 2009 to give information for setting up Yaws to work with WordPress permalinks. This is not unlike past experiences with Nginx, which has greatly improved its official documentation; but be warned, unless you have simple needs, you might get to spend a lot of time trying things out, adjusting, and playing to get your site up and running. On the positive side, if you are looking for a fun experiment, perhaps as a student running a server just to learn rather than to host vital content, Yaws could be exactly what you want. Who knows, because it is an open-source project, you might find yourself studying Erlang and contributing either code or documentation.

Cherokee

The distinguishing feature of Cherokee among the crowd that claims both speed and lightness is its ease of configuration. Cherokee supports all the big features, like virtual hosts, CGI, load balancing, and so on. It also includes a graphical interface for configuration, which makes it unique among all the options in this chapter. The claim is that you can configure Cherokee without ever editing a configuration file.

Setting up Cherokee is as easy as installing it on your system and then opening the Cherokee admin interface by issuing the cherokee-admin-launcher command as root. The downside is that this assumes you are running a graphical user interface on the same system as your web server, which is something that most Linux admins do not do. However, fear not. It is possible to use this interface remotely from a system with a web browser and terminal access via ssh using the remote system’s IP address and a specific port (which is configurable).

The other features of Cherokee are comparable to lighttpd and Nginx. If you like what they offer, but want to use a GUI for your administration tasks, Cherokee is worth a closer look. The end user documentation available from their site is excellent and should get you up and running easily.

Jetty

If you are hosting a personal WordPress site or a few static HTML pages, Jetty is not what you need. Jetty is an Eclipse Foundation project that is written in Java. The Eclipse Foundation exists to provide open-source development tools, software frameworks, and more to anyone who wants to use them. Jetty is a web server and client. It is a javax.servlet container. It supports Web Sockets and many other integrations. All of Jetty’s components are open source and freely available, even for commercial use and distribution. Jetty powers frameworks such as Google Web Toolkit (code.google.com/webtoolkit/) and Yahoo!’s Hadoop (developer.yahoo.com/hadoop/). It works with Apache Maven (http://maven.apache.org) to provide a way to run a web application locally while in development.

Jetty isn’t really a standalone web server in the traditional sense, but rather creates a way to use Java code for web applications. Jetty is complex enough to warrant a book of its own. If you are developing web applications using Java and want a highly configurable network of connectors and handlers at your disposal (and you know what that phrase means), Jetty is a pretty good choice. Jetty components are simple, Plain Old Java Objects (POJOs). Jetty has an API that makes using it in Java easy. As the website says, “Jetty provides an HTTP server and Servlet container capable of serving static and dynamic content either from a standalone or embedded instantiations.” If you need it, it is great. If you don’t, it will be overkill.

thttpd

thttpd is a very light, decidedly not flashy or feature-filled web server. It has not been abandoned, but does not seem to be updated frequently. It is included here for one main reason: It has an interesting feature that makes it unique. First, we give you a general description of the web server.

thttpd is small and simple. It claims to have only slightly more than is necessary to support HTTP 1.1. No bells. No whistles. The positive side is that simple code generally has fewer stability issues, has fewer security and performance problems, and uses less memory. Your Virtual hosts can be easily configured in thttpd using a familiar format. Getting CGI-type content to run is more complicated than with any of the other servers in this chapter as it is not supported out of the box.

Here is the really interesting part: thttpd has a throttling feature that lets you set maximum byte rates on URLs or URL groups. You can limit the speed or use of your site’s bandwidth according to the URL being requested by the client. You could use this to host media files and allow them to be accessed while assuring you have plenty of bandwidth available for other users to access your static HTML pages.

thttpd does not appear to have been updated since sometime in 2005, so it might not be suitable for use on a production server, although there is some evidence that it was once used on a few well-known websites. It seems the world has moved on. However, the throttle-by-requested-URL is an interesting idea making it worthy of a mention here.

Apache Tomcat

Apache Tomcat is a common and frequently used open-source Java servlet container that implements Oracle’s Java Servlet and JavaServer Pages (JSP) specifications. By doing so, Tomcat provides the means to run Java code in a web server environment. Java programmers love it because they can write web applications in a language they already know. Tomcat can be used as a standalone pure-Java web server, but is often used in conjunction with the regular Apache or another general purpose web server. In those instances, Tomcat serves requests from the other web server.

References

Image www.lighttpd.net—The main website for lighttpd.

Image http://yaws.hyber.org—The main website for Yaws.

Image www.cherokee-project.com—The main website for Cherokee.

Image http://eclipse.org/jetty/—The main website for Jetty.

Image www.acme.com/software/thttpd/—The main website for thttpd.

Image http://tomcat.apache.org—The main website for Apache Tomcat.