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
代碼如下: