這篇文章主要介紹“如何在CentOS系統(tǒng)中編譯安裝Hiawatha服務(wù)器”,在日常操作中,相信很多人在如何在CentOS系統(tǒng)中編譯安裝Hiawatha服務(wù)器問(wèn)題上存在疑惑,小編查閱了各式資料,整理出簡(jiǎn)單好用的操作方法,希望對(duì)大家解答”如何在CentOS系統(tǒng)中編譯安裝Hiawatha服務(wù)器”的疑惑有所幫助!接下來(lái),請(qǐng)跟著小編一起來(lái)學(xué)習(xí)吧!
創(chuàng)新互聯(lián)建站堅(jiān)持“要么做到,要么別承諾”的工作理念,服務(wù)領(lǐng)域包括:成都網(wǎng)站設(shè)計(jì)、成都網(wǎng)站建設(shè)、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣等服務(wù),滿足客戶于互聯(lián)網(wǎng)時(shí)代的陽(yáng)谷網(wǎng)站設(shè)計(jì)、移動(dòng)媒體設(shè)計(jì)的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡(luò)建設(shè)合作伙伴!
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
#tar xvf cmake-2.8.10.2.tar.gz
#cd cmake-2.8.10.2
本機(jī)上不存在cmake。則
代碼如下:
#./bootstrap
#make
#make install
如果系統(tǒng)中已經(jīng)裝了低版本的cmake,輸入如下命令:
代碼如下:
#cmake
#make
#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
#cd hiawatha-9.0
#mkdir build
#cd build
#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
#make
#make install
#hiawatha -k //檢測(cè)安裝是否成功,如果輸出以下提示,則表示安裝成功
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
方法:這也是系統(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
#
# 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
# 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
#}
# BANNING SETTINGS
# Deny service to clients who misbehave.
#
BanOnGarbage = 300
BanOnMaxPerIP = 60
BanOnMaxReqSize = 300
KickOnBan = yes
RebanDuringBan = yes
# 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
FastCGIserver {
FastCGIid = PHP5
ConnectTo = /var/lib/hiawatha/php-fcgi.sock //根據(jù)自己所在的位置填寫(xiě)
Extension = php
}
# 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
#}
# 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
# 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
#}
# 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
#kill -15 pidnumber //pidnumber就是hiawatha的pid
以下是php-fpm.confg
代碼如下:
[www]
user = www
group = www
listen = /var/lib/hiawatha/php-fcgi.sock
pm = static
pm.max_children = 3
chdir = /
到此,關(guān)于“如何在CentOS系統(tǒng)中編譯安裝Hiawatha服務(wù)器”的學(xué)習(xí)就結(jié)束了,希望能夠解決大家的疑惑。理論與實(shí)踐的搭配能更好的幫助大家學(xué)習(xí),快去試試吧!若想繼續(xù)學(xué)習(xí)更多相關(guān)知識(shí),請(qǐng)繼續(xù)關(guān)注創(chuàng)新互聯(lián)網(wǎng)站,小編會(huì)繼續(xù)努力為大家?guī)?lái)更多實(shí)用的文章!