Hiawatha 是一個(gè)Linux/UNIX下安全的Web服務(wù)器,其設(shè)計(jì)的最主要的目的就是安全,當(dāng)然它也是快速的而且易于配置。在安裝之后,確實(shí)發(fā)現(xiàn)他真的是輕量級(jí)的,安裝部署相當(dāng)?shù)目臁R韵率前惭b的過(guò)程:
第一步:下載編譯安裝cmake因?yàn)镠iawatha要求是cmake才能編譯,我的系統(tǒng)里沒(méi)有安裝,但是注意,這里的cmake是有版本要求的,至少是2.8.4以上的版本,索性我就安裝了最新的版本cmake 2.8.10.
#wgethttp://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz/p>
p> #tar xvf cmake-2.8.10.2.tar.gz/p>
p> #cd cmake-2.8.10.2
本機(jī)上不存在cmake。則
#./bootstrap/p>
p> #make/p>
p> #make install
如果系統(tǒng)中已經(jīng)裝了低版本的cmake,輸入如下命令:
#cmake/p>
p> #make/p>
p> #make install
第二步:下載Hiawatha(libxml2 and libxslt是hiavatha必須要求的,沒(méi)有的自行安裝,我已經(jīng)有了)
#wget --no-check-certificate https://www.hiawatha-webserver.org/files/hiawatha-9.0.tar.gz //wget
可以下載http,https,ftp的鏈接,這里是https,所以我們?cè)O(shè)置為不檢查證書(shū),直接下載,參考wget下載https鏈接(轉(zhuǎn))
#tar -xzf hiawatha-9.0.tar.gz/p>
p>#cd hiawatha-9.0/p>
p>#mkdir build/p>
p>#cd build/p>
p>#cmake .. -DENABLE_CACHE=ON -DENABLE_DEBUG=off -DENABLE_IPV6=off -DENABLE_MONITOR=off -DENABLE_RPROXY=ON -DENABLE_SSL=ON -DENABLE_TOMAHAWK=off -DENABLE_TOOLKIT=ON -DENABLE_XSLT=off/p>
p>#make/p>
p>#make install/p>
p>#hiawatha -k //檢測(cè)安裝是否成功,如果輸出以下提示,則表示安裝成功/p>
p>Using
Reading hiawatha.conf
Configuration OK
注意:運(yùn)行cmake時(shí)候如果出現(xiàn)
CMake Error: Could not find CMAKE_ROOT !!!
CMake has most likely not been installed correctly.
Modules directory not found in
/usr/bin
CMake Error: Error executing cmake::LoadCache(). Aborting.
的錯(cuò)誤提示,很大的可能不是你的cmake的設(shè)置有問(wèn)題,輸入“echo $CMAKE_ROOT”,看返回時(shí)什么,如果沒(méi)有返回,或返回的不是你的cmake安裝的目錄,那么就肯定會(huì)出現(xiàn)這個(gè)錯(cuò)誤,因?yàn)檎也坏?CMAKE_ROOT 這個(gè)變量值, 那我們就可以輸入以下命令,告訴系統(tǒng),cmake的安裝目錄是哪里,
#export CMAKE_ROOT=/usr/local/bin/cmake
這個(gè)根據(jù)自身的安裝路徑設(shè)定,就可以解決這個(gè)錯(cuò)誤了
有的可能在編譯的時(shí)候還出現(xiàn)下面的錯(cuò)誤:
bash: /usr/bin/cmake: No such file or directory/p>
p>方法:這也是系統(tǒng)找不到cmake在哪,所以我們一樣要告訴系統(tǒng)
#ln -s /usr/local/bin/cmake /usr/bin //做一個(gè)軟連接
如果上面都沒(méi)生效,你又記者用cmake編譯,最快的方法是用find命令,查看cmake的可執(zhí)行文件在哪里,然后直接用cmake可執(zhí)行文件的絕對(duì)路徑來(lái)編譯
如:
find / -name "cmake"
顯示結(jié)果:
/usr/local/bin/cmake
那么,你可以這樣編譯:
/usr/local/bin/cmake
后面加上你要編譯和源代碼路徑和編譯的參數(shù)
第三步:修改配置文件hiawatha.conf
#vi /usr/local/etc/hiawatha/hiawatha.conf
我沒(méi)多大修改配置:
# Hiawatha main configuration file
#/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 //根據(jù)自己所在的位置填寫(xiě)
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
#}
啟動(dòng)命令:
#/usr/local/sbin/hiawatha //根據(jù)自己的安裝目錄決定
關(guān)閉停止命令:
#pgrep hiawatha //查看hiawatha的pid/p>
p>#kill -15 pidnumber //pidnumber就是hiawatha的pid
以下是php-fpm.confg
[www]/p>
p> user = www/p>
p> group = www/p>
p> listen = /var/lib/hiawatha/php-fcgi.sock/p>
p> pm = static/p>
p> pm.max_children = 3/p>
p> chdir = /