Chapter 27

Other HTTP Servers

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 25, “Apache Web Server Management” or Chapter 26, “Nginx Web Server Management.” This chapter covers other HTTP servers, including lighttpd, Yaws, Cherokee, Jetty, thttpd, Apache Tomcat, WildFly, and Caddy.

lighttpd

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

One thing that sets lighttpd apart from Nginx is that although 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. The main WordPress site (which WordPress hosts itself) uses Nginx and is built with PHP, so this is not an insurmountable task with Nginx—and web tutorials abound. With lighttpd, the ability to natively function as a server for CGI content 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 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, which stands for Yet Another Web Server, 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.

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 (and is acknowledged by the site with a disclaimer). This is not unlike earlier experiences with Nginx, which has greatly improved its official documentation; but be warned, unless you have simple needs, you might have 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? It is an open source project, and 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 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 those of 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 the Cherokee 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 is used in products like Apache ActiveMQ (https://activemq.apache.org/) and Google App Engine (https://cloud.google.com/appengine/). It works with Apache Maven (https://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. Rather, it 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 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’s great. If you don’t, it’s overkill.

thttpd

thttpd is a very light, decidedly not flashy or feature-filled web server. It has not been abandoned, but it 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 provide 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 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 take advantage of this feature, for example, by hosting media files and allowing them to be accessed while ensuring you have plenty of bandwidth available for other users to access your static HTML pages.

thttpd is not updated frequently, 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 that the world has moved on. However, the throttle-by-requested-URL is an interesting idea and makes 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 it is often used in conjunction with the regular Apache web server or another general-purpose web server. In those instances, Tomcat serves requests from the other web server.

WildFly

WildFly is more than a web server. It is an application runtime for Java web applications. As such, it does more than Tomcat, which may be exactly what you need, or it may be overkill, depending on your project. It is used to host many enterprise-focused applications and is the open source, community-developed upstream from which Red Hat builds its JBoss Enterprise Application Platform (EAP).

Caddy

Caddy is an open source web server written in Go. It uses the Go standard library for its HTTP functionality, with HTTPS enabled by default. It is designed to have fewer moving parts and to run great in containers because it has no dependencies. Caddy manages TLS certificate renewals, Online Certificate Status Protocol (OCSP) stapling, which checks the revocation status of X.509 digital certificates. It can handle static file serving, reverse proxying, and Kubernetes ingress. Caddy is fairly new and worth watching.

References

www.lighttpd.netThe main website for lighttpd

https://yaws.hyber.orgThe main website for Yaws

www.cherokee-project.comThe main website for Cherokee

https://eclipse.org/jetty/The main website for Jetty

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

www.wildfly.orgThe main website for WildFly

https://caddyserver.comThe main website for Caddy

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

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.133.126.199