Caddy – A Lightweight HTTP/2 Web Server to Deploy and Test Websites Easliy
A web server is a Server side application designed to process HTTP requests between client and server. HTTP is the basic and very widely used network protocol. We all would be familiar with Apache HTTP Server.
Apache HTTP Server played an important role in designing what web is today. It alone has a market share of 38%. Microsoft IIS comes second in the list having a market share of 34%. Nginx and Google’s GWS comes at number 3 and 4 having a market share of 15% and 2% respectively.
Last day I came across a web server named Caddy. When I tried to inquire it’s features and deployed it to testing, I must say it is amazing. A web server which is portable and do not need any configuration file. I though it is a very cool project and wanted to share it with you. Here we have given Caddy a try!
What is Caddy?
Caddy is an alternative web server easy to configure and use. Matt Holt – The Project leader of Caddy claims that Caddy is a general-purpose web server, claims to be designed for human and it is probably the only of its kind.
Features of Caddy
- Speedy HTTP requests using HTTP/2.
- Capable Web Server with least configuration and hassle free deployment.
- TLS 1.2 encryption ensure, encryption between communicating applications and user over Internet. You may use your own keys and certificates.
- Easy to deploy/use. Just one single file and no dependency on any platform.
- No installation required.
- Portable Executables.
- Run on multiple CPUs/Cores.
- Advanced WebSockets technology – interactive communication session between browser and server.
- Server Markdown documents on the fly.
- Full support for latest IPv6.
- Creates log in custom format.
- Serve FastCGI, Reverse Proxy, Rewrite and Redirects, Clean URL, Gzip compression, Directory Browsing, Virtual Hosts and Headers.
- Available for All known Platform – Windows, Linux, BSD, Mac, Android.
What make caddy Different?
- Caddy aims at serving web as it should be in the year 2015 and not traditional style.
- It is designed not only to serve HTTP request but also human.
- Loaded with Latest features – HTTP/2, IPv6, Markdown, WebSockets, FastCGI, templates and other out-of-box features.
- Run the executables without the need of Installing it.
- Detailed documentation with least technical description.
- Developed keeping in mind the need and ease of Designers, Developers and Bloggers.
- Support Virtual Host – Define as many sites as you want.
- Suited for you – no matter if your site is static or dynamic. If you are human it is for you.
- You focus on what to achieve and not how to achieve.
- Availability of support for most number of platforms – Windows, Linux, Mac, Android, BSD.
- Usually, you have one Caddy file per site.
- Set up in less than 1 minute, even if you are not that much computer friendly.
I will be testing it on CentOS server, as well as Debian Server. For both the server I am going to use 64 bit executables.
Operating Systems: CentOS 7 and Debian 8 Jessie Caddy Version: 0.5.1 - 64-bit
Installation of Caddy Server in Linux
No matter you are on what platform and which kind of architecture your are using, caddy provides ready to use executable packages (Version 0.5.1), which can be downloaded from the official caddy download page.
Alternatively, you can use following command to download and extract the archive into a folder caddy and change current working directory to caddy and list the contents of the directory.
------------------- On 32-bit Systems ------------------- $ wget https://github.com/mholt/caddy/releases/download/v0.5.1/caddy_linux_386.zip $ unzip -d caddy caddy_linux_386.zip $ cd caddy $ ls -l
------------------- On 64-bit Systems ------------------- $ wget https://github.com/mholt/caddy/releases/download/v0.5.1/caddy_linux_amd64.zip $ unzip -d caddy caddy_linux_amd64.zip $ cd caddy $ ls -l
Here we can see that three files are here. Two text files namely ‘README.txt‘ and ‘CHANGES.txt‘ and one executable file namely ‘caddy_linux_amd64‘. The executable is what we need to setup instant web server. Either move the executable to any folder that contains HTML file (probably but not necessarily index.html) or create a file in the current directory for testing. We will be creating a HTML file in the current directory to test it.
Now open a web browser and point to any html page (you may create your’s own). Save the page in the folder where caddy executable is. Now fire the caddy executables and point your browser to localhost at port 2015/html_page_name.html and you should be able to see your page.
If the html page is saved as index.html you don’t need to tell your browser to look for the file name as index.html is the primary file, which will be looked automatically.
The default port caddy uses is 2015. You may kill the process ‘caddy‘ once it is done or you may like to run another instance of caddy in the same login session.
Interested in compiling it with source and configure as per your need? You may like to see full documentation. The Link is included in Reference section below.
If you are newbies and want to setup a webserver without getting your hands dirty with configuration, this tool is for you. Even if you are an experienced user whose need is instant and simple web server Caddy is worth a try. With a little configuration you may also set folder permission, control authentication, error pages, Gzip, HTTP redirect and others, if you need to setup a more complex and advanced webserver.
Don’t take Caddy as a replacement of Apache or Nginx. Caddy is not designed to handle high traffic production environment. It is designed for quick web server setup when you concern is speed and reliability.
Complete user Guide / Full Documentation of Caddy Web Server
We have brought this documentation which aims at quick review and installation instructions with images where ever necessary. If you come across any pros/cons of the project or any suggestion, you may give it to us in our comment section.
For me this project is too young still works flawlessly and seems powerful and promising. The biggest plus point I see is caddy don’t need to carry its configuration file everywhere. It aims at providing the best of nginx, lighthttpd, vagrant and websocketd. That’s all from my side. Keep connected to Tecmint. Kudos