/ webserver

Installing litespeed webserver on OS X Sierra

I have been running webservers in the past 20 years. Started out with Macintosh WebStar (no one remembers that...) and soon started to run Apache on RedHat and CentOS. For years I was running my own hardware with all the free nightmares that follow.

After cloud computing became dominant I never looked back and have been running Apache on different Linux distros. I recently converted as much as I could to nginx also because it ran node.js so easy.


Now I am testing out what seems to be a real speed deamon, litespeed! To get started I wanted to install it on my OS X machine. It was a breeze on CentOS and Ubuntu but not hassle free on my OS X Sierra MacBook Pro. Hope this can help someone with the same struggles.

I expect you are familiar with terminal for this tutorial but you don't have to be any expert!

Install Developer Command Line Tools

Check in terminal if you already have it:
$ xcode-select -p
should give an output of:
$ /Applications/Apple Dev Tools/Xcode.app/Contents/Developer

If not type you can type this in terminal to install the command line tools
$ xcode-select --install

You will also need openssl. I use brew to install openssl.
$ brew install openssl

Also I suggest installing geoIP which is required.
$ brew install geoip
or else you will get an error later.

Download and unpack litespeed

Get the source code at litespeedtech.com and download the latest version OpenLiteSpeed which is 1.4.24 as of writing.

Decompress the download and put it wherever you like (the installation will be somewhere else so your home folder is ok).

Now enter terminal and navigate to the installation folder.

Now this what will work on Ubuntu or Centos
cd openlitespeed-1.x.x ./configure make && make install but since OS X 10.11 there are some changes to openssl and where OS X puts things.

Modified installer command for OS X Sierra

You need to prefix openssl path on compiling and on my machine it is
/usr/local/opt/openssl

Now the compiler will complain about not finding md5.sh which is a part og openssl/includes so better fix this before compiling.

In brew I searched for md5.sh.
$ find /usr/local -name md5.h
$ /usr/local/Cellar/openssl/1.0.2j/include/openssl/md5.h

So we need to symblink it:

cd /usr/local/include ln -s /usr/local/Cellar/openssl/1.0.2j/include/openssl .

Installing

Now run this command inside the install folder
./configure CPPFLAGS=-I/opt/local/include LDFLAGS=-L/opt/local/lib --with-openssl=/usr/local/opt/openssl

This should go fast. Then it is time to make and make install

make && make install
This will take some time and eventually bring success.

To start the server, simply run /usr/local/lsws/bin/lswsctrl start. (To stop it, run /usr/local/lsws/bin/lswsctrl stop.)
Your litespeed server should be running on port 8088 and admin on port 8080.

These 2 errors below are common and can be fixed with my code above to symblink openssl/includes and installing geoip.

fatal error: 'GeoIP.h' file not found

fatal error: 'openssl/md5.h' file not found

Now is the time to head over to the docs and configure :-)

Note that you local docs on your server http://localhost:8088/docs/index.html