Hiawatha 是一个Linux/UNIX下安全的Web服务器,其设计的最主要的目的就是安全,当然它也是快速的而且易于配置。在安装之后,确实发现他真的是轻量级的,安装部署相当的快。以下是安装的过程:
第一步:下载编译安装cmake因为Hiawatha要求是cmake才能编译,我的系统里没有安装,但是注意,这里的cmake是有版本要求的,至少是2.8.4以上的版本,索性我就安装了最新的版本cmake 2.8.10.
本机上不存在cmake。则
如果系统中已经装了低版本的cmake,输入如下命令:
第二步:下载Hiawatha(libxml2 and libxslt是hiavatha必须要求的,没有的自行安装,我已经有了)
可以下载http,https,ftp的链接,这里是https,所以我们设置为不检查证书,直接下载,参考wget下载https链接(转)
Reading hiawatha.conf
Configuration OK
注意:运行cmake时候如果出现
CMake has most likely not been installed correctly.
Modules directory not found in
/usr/bin
CMake Error: Error executing cmake::LoadCache(). Aborting.
的错误提示,很大的可能不是你的cmake的设置有问题,输入“echo $CMAKE_ROOT”,看返回时什么,如果没有返回,或返回的不是你的cmake安装的目录,那么就肯定会出现这个错误,因为找不到 CMAKE_ROOT 这个变量值, 那我们就可以输入以下命令,告诉系统,cmake的安装目录是哪里,
这个根据自身的安装路径设定,就可以解决这个错误了
有的可能在编译的时候还出现下面的错误:
如果上面都没生效,你又记者用cmake编译,最快的方法是用find命令,查看cmake的可执行文件在哪里,然后直接用cmake可执行文件的绝对路径来编译
如:
显示结果:
那么,你可以这样编译:
后面加上你要编译和源代码路径和编译的参数
第三步:修改配置文件hiawatha.conf
我没多大修改配置:
#</p> <p># GENERAL SETTINGS
#
ServerId = www:www
ConnectionsTotal = 250
ConnectionsPerIP = 25
SystemLogfile = /usr/local/var/log/hiawatha/system.log
GarbageLogfile = /usr/local/var/log/hiawatha/garbage.log</p> <p># BINDING SETTINGS
# A binding is where a client can connect to.
#
Binding {
Port = 80
# Interface = 127.0.0.1
# MaxKeepAlive = 30
# TimeForRequest = 3,20
}
#
#Binding {
# Port = 443
# Interface = ::1
# MaxKeepAlive = 30
# TimeForRequest = 3,20
# SSLcertFile = hiawatha.pem
#}</p> <p># BANNING SETTINGS
# Deny service to clients who misbehave.
#
BanOnGarbage = 300
BanOnMaxPerIP = 60
BanOnMaxReqSize = 300
KickOnBan = yes
RebanDuringBan = yes</p> <p># COMMON GATEWAY INTERFACE (CGI) SETTINGS
# These settings can be used to run CGI applications.
#
#CGIhandler = /usr/bin/perl:pl
#CGIhandler = /usr/local/php/bin/php-cgi:php
#CGIhandler = /usr/bin/python:py
#CGIhandler = /usr/bin/ruby:rb
#CGIhandler = /usr/bin/ssi-cgi:shtml
#CGIextension = cgi</p> <p>FastCGIserver {
FastCGIid = PHP5
ConnectTo = /var/lib/hiawatha/php-fcgi.sock //根据自己所在的位置填写
Extension = php
}</p> <p># URL TOOLKIT
# This URL toolkit rule was made for the Banshee PHP framework, which
# can be downloaded from http://www.hiawatha-webserver.org/banshee
#
#UrlToolkit {
# ToolkitID = banshee
# RequestURI isfile Return
# Match ^/(css|files|images|js|slimstat)($|/) Return
# Match ^/(favicon.ico|robots.txt|sitemap.xml)$ Return
# Match .*\?(.*) Rewrite /index.php?$1
# Match .* Rewrite /index.php
#}</p> <p># DEFAULT WEBSITE
# It is wise to use your IP address as the hostname of the default website
# and give it a blank webpage. By doing so, automated webscanners won't find
# your possible vulnerable website.
#
Hostname = 127.0.0.1
WebsiteRoot = /home/wwwroot
StartFile = index.html
AccessLogfile = /usr/local/var/log/hiawatha/access.log
ErrorLogfile = /usr/local/var/log/hiawatha/error.log
ErrorHandler = 404:/error.cgi</p> <p># VIRTUAL HOSTS
# Use a VirtualHost section to declare the websites you want to host.
#
#VirtualHost {
# Hostname = 127.0.0.1
# WebsiteRoot = /home/wwwroot
# StartFile = index.php
# AccessLogfile = /var/www/my-domain/log/access.log
# ErrorLogfile = /var/www/my-domain/log/error.log
# TimeForCGI = 5
# UseFastCGI = PHP5
# UseToolkit = banshee
#}</p> <p># DIRECTORY SETTINGS
# You can specify some settings per directory.
#
#Directory {
# Path = /home/baduser
# ExecuteCGI = no
# UploadSpeed = 10,2
#}
启动命令:
关闭停止命令:
以下是php-fpm.confg