Cherokee is a free and open source web server. It is very lightweight, high performance, fast and flexible web server. It supports all the widespread technologies like FastCGI, SSL/TLS, PHP, CGI, SSI, virtual servers, authentication, compression, load balancing, reverse HTTP proxy etc. It comes with a web-based graphical administration interface which can be used to manage the server and the websites hosted.
In this tutorial, we will learn to install and use Cherokee web server on CentOS 7.
Requirements
Cherokee can be installed on systems with a very little amount of RAM, as the requirement of RAM increase as the number of hosted websites and users increases. You will also need a minimal installation of CentOS 7 with root access on it. If you are logged in as a non-root user, you can run sudo -i
to switch to root user. All the required software dependencies will be installed in this tutorial.
Installing Cherokee
Before installing any package it is recommended that you update the packages and repository using the following command.
yum -y install epel-release
yum -y update
Now you will need to install Python if you don’t have it installed. Most of the systems are already equipped with Python. You can check if your system has existing Python install, run the following command for same.
python -V
If you get the following output, you do not need to install Python, you can proceed further without installing Python.
[root@liptan-pc ~]# python -V
Python 2.7.5
If you do not have Python installed, run the following command to install Python 2.6.
wget https://www.python.org/ftp/python/2.7.13/Python-2.7.13.tgz
tar xzf Python-2.7.13.tar
cd Python-2.7.13
./configure
make install
Once Python is installed, you will need the Development Tools package to compile and install Cherokee. Install the package using the following command.
yum -y groupinstall 'Development Tools'
Now you will need to install Git so that you can clone the repository in your system. Run the following command for same.
yum -y install git rrdtool
Now clone the Cherokee repository using the following command.
cd ~
git clone http://github.com/cherokee/webserver.git
Now compile and install the web server using following commands.
cd webserver
./autogen.sh
make
make install
This command will automatically install the Cherokee web server to your server. Now run the following command to run admin panel and generate one-time login password for your Cherokee admin panel.
cherokee-admin
You should get an output similar to this.
[root@ip-172-31-24-93 webserver]# cherokee-admin
Cherokee Web Server 1.2.104 (May 6 2017): Listening on port 127.0.0.1:9090,
TLS disabled, IPv6 enabled, using epoll, 4096 fds system limit, max. 2041
connections, caching I/O, single thread
Login:
User: admin
One-time Password: FP38kQIJf2sxb5Z9
Web Interface:
URL: http://127.0.0.1:9090/
cherokee-admin
The output will contain the URL to administration panel as well as one-time password which can be used to login once only. If you need to login again in future, you will need to run this command.
But using the above command you will be able to open the administration panel through the system’s browsers only. To open administrative panel for a specific IP address, run the following command.
cherokee-admin -b <your-ip-addr>
To open the administrative panel for everyone, run the following command.
cherokee-admin -b 0.0.0.0
Once you browse the URL through your browser, you will see an authentication box, enter the credentials provided on the terminal, you will see the following interface.
HP_NO_IMG/data/uploads/users/5bc5f3e0-17df-4257-afd4-59fc57ecae4e/1906304545.png” alt=”” />
To immediately start the web server, click on the Start Server button. You can now browse the following URL to test if your web server is running correctly.
http://your-server-IP
You will see the following test page.
HP_NO_IMG/data/uploads/users/5bc5f3e0-17df-4257-afd4-59fc57ecae4e/1377179846.png” alt=”” />
Configuring the Server
To configure the general settings of your web server click on General menu from the top menu bar.
Network Settings
In the Network settings tab you can configure the following options.
- Enable IPv6 support: You can enable IPv6 support using the following option. For this option to work, the network controller of the server must be configured to enable IPv6 support.
- SSL/TLS back-end: Choose the SSL/TLS support for the backend of the web server, the default option is OpenSSL.
- Timeout: Choose the duration after which server will automatically disconnect all inactive clients.
- Information Collection: Choose the tool to generate graphs about the uses. Recommended is that you choose RTDtool, if you disable this option then no graphs will be shown in the status tab. You can disable this option to save resources.
- Upload Tracking: Track the uploading of the file so that the progress can be shown to the user.
HP_NO_IMG/data/uploads/users/5bc5f3e0-17df-4257-afd4-59fc57ecae4e/560436070.png” alt=”” />
In the Ports settings tab, you can choose the ports on which Cherokee will listen to. Default HTTP port is 80 and defaults HTTPS port is 443.
In the Permissions tab you can configure the user and group for your web server. You can also use Chroot to jail the server inside the directory.
In the Icons tab you can choose different icons to use in web server environment.
In the MIME Types, you can choose the MIMEs types along with the extensions associated. You can also specify their caching periods.
Click Save button at the top bar to save the changes. Perform a graceful restart so that the changes may reflect immediately.
Virtual Servers
Virtual Servers in Cherokee is used to host multiple domains on a single web server. It is similar to Virtual Hosts in Apache web server.
To access the virtual web server click on vServers from top menu bar. You will find the default virtual server there.
HP_NO_IMG/data/uploads/users/5bc5f3e0-17df-4257-afd4-59fc57ecae4e/1445254801.png” alt=”” />
In the Basics tab of default virtual server, you can configure the path of the document root. Default document root is /usr/local/var/www
. In Directory Indexes, you can set the name of the file which is to loaded when the web site is loaded, fir example index.html, index.php
. In Keep-alive option, you can choose whether to keep the connection alive as per each virtual server. In Max Upload Size choose the upload limit of the file size. The default option is unlimited.
In the Host Match tab, you can choose for which requests the website from this virtual server will be loaded. You can enter either FQDN (Fully Qualified Domain Names), wild card entries, regular expressions, IPs/Subnets, or a combination of methods that will be evaluated as a logical OR. For example, you can enter *.example.com
and example.org
. The website will now be accessible from all the subdomains of example.com
as well as from example.org
.
In the Behaviour tab you can choose how the server should handle the different requests.
In the Error Handler tab, you can set the error pages to be displayed for different types of error. For example, you can set a specific not found page for error 404.
In the Logging tab you can choose whether to write the errors or not and if you choose to write the error, then where to write it. You can choose to write the error in a file, you will need to provide the path. Default path for error log is /usr/local/var/log/cherokee.error
and for access log is /usr/local/var/log/cherokee.access
.
In the Security tab you can configure the SSL support for your virtual server.
Conclusion
In this tutorial, we have learned how to setup Cherokee server on CentOS 7. We also learned to configure the settings and virtual servers of the Cherokee web server.